Add Button to Your Macro (Alternative Options) | Excel VBA Tip

preview_player
Показать описание
Excel VBA Tip: Add Button to Your Macro (Alternative Options)

Code:
Sub save_range_as_pdf()

Dim pdf_range As Range
Dim ws As Worksheet

Set ws = ThisWorkbook.Sheets("Sheet1")
Set pdf_range = ws.Range("B2:C14")

ws.PageSetup.CenterHorizontally = True

pdf_range.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Users\greggowaffles\Documents\" & _
"Youtube Videos\Test\Cookie Sales Reports\" & _
"Cookie Sales Report " & _
ws.Range("B11").Text & ".pdf", OpenAfterPublish:=True

End Sub

#excelmacro #excelvba
Рекомендации по теме