Consulting

Results 1 to 2 of 2

Thread: Defining Ranges Using VBA

  1. #1
    VBAX Newbie
    Joined
    Jan 2013
    Posts
    1
    Location

    Defining Ranges Using VBA

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •