+ Reply to Thread
Results 1 to 15 of 15

Hide/Unhide Rows macro

  1. #1
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Question Hide/Unhide Rows macro

    Hello and Help!

    Using this macro for column a with values at "NIU" but my data spans d5:ey485 and should really be for values shown as 0. would appreciate anyone's help. Thanks!

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 10-08-2012 at 10:25 AM. Reason: Please use code tags when posting code...Thanks.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Hide/Unhide Rows macro

    Your macro is hidding the entirerow if it finds "NIU" in column "A" only. In which columns/ rows do you see "NIU" ?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    Right now the Macro is working correctly, however I'd like to expand the macro to find rows within d5:ey485 with the value as 0 instead of looking only in column a for value "niu".

  4. #4
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Hide/Unhide Rows macro

    PHP Code: 
    Sub NValencia()
     
    Dim Rng As RangehRng As RangesRng As Range
     Dim MyAdd 
    As String
     
     Set Rng 
    Range([A1], [A999].End(xlUp))
     [
    A1].Resize(Rng.Rows.Count).EntireRow.Hidden False
     Set sRng 
    Rng.Find("NIU", , xlFormulasxlWhole)
     If 
    sRng Is Nothing Then
        MsgBox 
    "Nothing"
     
    Else
        
    MyAdd sRng.Address
        
    Do
            If 
    hRng Is Nothing Then
                Set hRng 
    sRng 
            
    Else
                
    Set hRng Union(hRngsRng
            
    End If
            
    Set sRng Rng.FindNext(sRng)
        
    Loop While Not sRng Is Nothing And sRng.Address <> MyAdd
        
    If Not hRng Is Nothing Then
            hRng
    .EntireRow.Hidden True
        End 
    If
     
    End If
    End Sub 

  5. #5
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    It's still looking for "NIU"; How can I change the macro to find rows within d5:ey485 with the value as "0" instead of looking value "niu".

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Hide/Unhide Rows macro

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by AB33; 10-08-2012 at 01:24 PM.

  7. #7
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Hide/Unhide Rows macro


  8. #8
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    Picture1.jpg

    Here's what I'm working with. I already have a macro to hide columns, but the macro above isn't hiding rows 6,7,9-18....

    I'm so appreciative of everyone's help!!

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Hide/Unhide Rows macro

    Please attach a sample workbook with a desired result

  10. #10
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    Can't attach a file but, does this help visualize what I'm looking for?Picture2.jpg

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Hide/Unhide Rows macro

    I amended my macro- see post 6. I can not hep you I do not see in a sample format. You do not need to attach any book with confidential info, just a sample

  12. #12
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    AB33, thanks but my zero's are still showing up...not sure why. no confidential data; i just don't see the option to upload file, just see option to upload photo. bummed...but thanks again

  13. #13
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    Ah! I found attach file option... see attached.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Hide/Unhide Rows macro

    Now, explain what is missing. I have attached two macros
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    10-08-2012
    Location
    Rosslyn, VA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Hide/Unhide Rows macro

    Ok, rows 3,4,6,8 and 11 (all in grey) should be hidden, since they have no values in those rows

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1