I have an excel spreadsheet that works just as I'd like it to. I am trying to create the same sheet using VBA so I can have multiple sheets in the same workbook. Copy/paste does not work as it does not copy/paste the 3 command buttons. My command button code is basic and I can create the button but not add the code via VBA.
One code is:
>>> use code - tags <<<
Any help adding this to a spreadsheet via VBA is appreciated. My current spreadsheet is attached and what I have tried is at the bottom of the code. When I create a new sheet and run the macro, it prints everything instead of what is requested. Using the sheet created without VBA, it works perfectly.
One code is:
>>> use code - tags <<<
Code:
Private Sub CommandButton2_Click()
Worksheets("Sheet1").PageSetup.PrintArea = Range("L2").Value & ":" & Range("L3").Value
PrintPreview
End Sub
Attachments
Last edited by a moderator: