Hide / UnHide Rows w/VBAcode
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Hide / UnHide Rows w/VBAcode

  1. #1
    Guest

    Default

     
    Hi, i can hide Unhide 1 row With:

    Option Explicit
    If Range ("D6") = 0 Then
    Range("D6").EntireRow.Hidden = True

    If Range ("D6") > 0 Then
    Range("D6").EntireRow.Hidden = False
    ---------
    What i'm trying to achive is:
    If the Range of ("D6:D1000")has a "0" then
    that row is hidden

    Thanks for any help,
    James



  2. #2
    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-09 12:00, Anonymous wrote:
    Hi, i can hide Unhide 1 row With:

    Option Explicit
    If Range ("D6") = 0 Then
    Range("D6").EntireRow.Hidden = True

    If Range ("D6") > 0 Then
    Range("D6").EntireRow.Hidden = False
    ---------
    What i'm trying to achive is:
    If the Range of ("D6:D1000")has a "0" then
    that row is hidden

    Thanks for any help,
    James


    James, would autofilter work for you? (You can do this via code if you want).

    Barrie Davidson

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

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hi

    Try:

    Sub ToggleHide()
    Range("D6").EntireRow.Hidden = (Range("D6").Text = "0")
    End Sub

    You cannot use just Range("D6") as this is the same as Range("D6").Value and the Value of an empty cell is zero, ulles that is what you want of course.



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
  •  

 

 
DMCA.com