advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 295 for cell filename (0.001 sec.)
cell (1170), filename (1984)
[[20210513174945]]
#score: 11157
@digest: 7f7e9349b325e53ab9780d0186c6c7ab
@id: 87643
@mdate: 2021-05-17T08:31:31Z
@size: 2445
@type: text/plain
#keywords: excelvba373 (7055), printarea (5374), printsheet (4741), 部範 (4557), xlportrait (3317), filepath (3287), xlqualitystandard (2975), myrange (2838), quality (2754), fittopagestall (2750), openafterpublish (2655), fittopageswide (2633), 後続 (2452), cell (2347), ignoreprintareas (2179), xltypepdf (1963), exportasfixedformat (1859), とce (1790), excelvba1 (1415), filename (1271), 砂糖 (1259), で失 (886), pagesetup (841), ー10 (770), orientation (664), 動作 (580), cells (571), screenupdating (539), string (482), 修正 (423), 時エ (412), 正確 (402)
『RangeとCellsによるPrintAreaの指定』(ゆき)
お世話になります、ゆきと申します。 基礎的なところだと思うのですが、周りにVBAの関係で質問できる方がいないので失礼します。 Excelのシートの一部範囲を変数(RangeとCellsの組み合わせ)で指定して、PDFで印刷したいと考えており、以下のようなコードを作成しましたが、エラーが出てしまいました。 RangeやCellsの前に「.」を噛ませてもみた(それが正しいのかもよくわかっていません)のですが、上手くいかず、どこを修正すれば良いのか手詰まりになっています。 申し訳ありませんが、どのように修正したらよいのかご教示いただきませんでしょうか。 【コード】 Sub Set_Save() Dim T_Cell As String Dim B_Cell As String Dim myRange As Range Dim S_FilePath As String Dim S_FileName As String S_FilePath = Range("A1").Value S_FileName = S_FilePath & "¥" & Range("A2").Value & ".pdf" Application.ScreenUpdating = False Range("A1").Activate Set myRange = Range("A:A").Find("合算結果", , xlValues, xlWhole) If myRange Is Nothing Then T_Cell = InputBox("タイトル行を見つけられませんでした。印刷範囲の最初の行を指定してください", "20") Else T_Cell = MyRange.Row End If B_Cell = Cells(Rows.Count, "C").End(xlUp).Row With ActiveSheet.PageSetup .Orientation = xlPortrait .Zoom = False .FitToPagesTall = 1 .FitToPagesWide = 1 .PrintArea = Range(Cells(T_Cell, 1), Cells(B_Cell, 3)) End With Sheets(printSheet).ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=S_FileName, _ Quality:=xlQualityStandard, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=True Application.ScreenUpdating = True End Sub 【エラーの内容】 実行時エラー1004「参照が正しくありません」 .PrintArea = Range(Cells(T_Cell, 1), Cells(B_Cell, 3))のところに対して表示されます。 それ以降の行についてはまだ動作を確認できていませんが、念のため掲載しました。 ご面倒をおかけしますが、どうぞよろしくお願いします。 < 使用 Excel:Excel2016、使用 OS:Windows10 > ---- PrintAreaはString型で指定です https://excel-ubara.com/excelvba1/EXCELVBA373.html VBEで確認できてないですが .PrintArea = Range(Cells(T_Cell, 1), Cells(B_Cell, 3)).address とかで動くんじゃないですか (砂糖) 2021/05/13(木) 18:37 ---- 早速のお返事ありがとうございました。 無事に動作しました(正確には、後続にもミスがあったので、それも修正したところ動作しましたが、ご教示いただいた内容で問題の箇所は通過できました)。 大変助かりました、初歩的なところで失礼いたしました。 (ゆき) 2021/05/17(月) 17:31 ...
https://www.excel.studio-kazu.jp/wiki/kazuwiki/202105/20210513174945.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 97054 documents and 608269 words.

訪問者:カウンタValid HTML 4.01 Transitional