Thanks Thanks:  0
Likes Likes:  0
Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: VBA to hide a row

  1. #21
    Board Regular
    Join Date
    Feb 2002
    Location
    Arizona
    Posts
    72
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    this one works perfectly! EXCEPT it stops at row 61?? and how do I apply it to multiple sheets?
    Like this?:
    For Each c In Sheets("sheet1","sheet2").Range("T1", Range("T65536").End(xlUp).Address)

  2. #22
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-06 15:44, jeffmfrank wrote:
    this one works perfectly! EXCEPT it stops at row 61?? and how do I apply it to multiple sheets?
    Like this?:
    For Each c In Sheets("sheet1","sheet2").Range("T1", Range("T65536").End(xlUp).Address)
    Is row 61 the last row in column T with data in it?

    To apply it to multiple sheets use:
    Code:
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
    Application.ScreenUpdating = False
    For Each c In Sheets("Sheet1").Range("T1", Range("T65536").End(xlUp).Address)
        Select Case c.Value
        Case Is = "Y"
            c.EntireRow.Hidden = True
        Case Is = "N"
            c.EntireRow.Hidden = False
        End Select
    Next c
    For Each c In Sheets("Sheet2").Range("T1", Range("T65536").End(xlUp).Address)
        Select Case c.Value
        Case Is = "Y"
            c.EntireRow.Hidden = True
        Case Is = "N"
            c.EntireRow.Hidden = False
        End Select
    Next c
    Application.ScreenUpdating = True
    End Sub
    Again, note that this will really slow down performance if you have a lot of data in column T (in either sheet).

    Regards,

    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  3. #23
    Board Regular
    Join Date
    Feb 2002
    Location
    Arizona
    Posts
    72
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I can get rid of the row 61 problem although it's odd that it's occurring. The data only lies between T4:T80. Thanks for the help. This will work perfectly for my needs.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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