opopanax666
New Member
- Joined
- Sep 27, 2006
- Messages
- 18
Hi guys & gals,
Here's 'my' code :
Private Sub CommandButton1_Click()
Dim MyValue As Integer
Sheets("Blad1").Select
MyValue = Range("ab1").Value
Range("$A$1:$Z$" & MyValue).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$Z$" & MyValue
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Registers").Select
End Sub
So, the button is placed on sheet "Registers", the area to print on "Blad1". I'm using a formula to give me the # of rows to print in cell AB1 on "Blad1" (can only be integer, btw).
I'm new to VB, but this ought to be pretty straightforward, so why does it give me an error in "Range("$A$1:$Z$" & MyValue).Select"?
Thank you for any feedback.
Here's 'my' code :
Private Sub CommandButton1_Click()
Dim MyValue As Integer
Sheets("Blad1").Select
MyValue = Range("ab1").Value
Range("$A$1:$Z$" & MyValue).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$Z$" & MyValue
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Registers").Select
End Sub
So, the button is placed on sheet "Registers", the area to print on "Blad1". I'm using a formula to give me the # of rows to print in cell AB1 on "Blad1" (can only be integer, btw).
I'm new to VB, but this ought to be pretty straightforward, so why does it give me an error in "Range("$A$1:$Z$" & MyValue).Select"?
Thank you for any feedback.