The sheets inside my Excel file are dynamic. I have a button that creates a sheet with it's new name.
Is it possible to select a worksheet in dynamic way? Or without knowing the names of the sheets.
Here's my vba code for printing a specific range of cells
Private Sub CommandButton1_Click()
Sheets("-32628").Select
range("A1:BZ18").Select
ActiveSheet.PageSetup.PrintArea = "A1:BZ18"
ActiveWindow.SelectedSheets.PrintOut from:=1, To:=1, Copies:=1, Collate _
:=True
End Sub
What I want is to select the Sheetname: -32628
without putting the actual name of sheet?