Defining Ranges Using VBA

sunny123

New member
Joined
Feb 1, 2013
Messages
1
Reaction score
0
Points
0
Hello Friends,

I am new to to VB does have only vague idea about it..

Private Sub CommandButton1_Click()
Range(Range("a1").End(xlDown).Offset(1, 0), Range("a" & Rows.Count)).EntireRow.Hidden = True
End Sub

Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Range(Range("a1"), Range("a" & Rows.Count)).EntireRow.Hidden = False
End Sub

I have a macro enabled book with a button to hide and unhide rows,but the
problem with this code is it is hiding the entire blank "a" rows,i dont need like that just need to specify a range like A1:A50,i tried to change but it gives me a debug error..

Regards,
Sunny
 
What is wrong with

Code:
Rows("1:50").Hidden = True
 
Back
Top