Consulting

Results 1 to 9 of 9

Thread: Solved: Hide Row Based On First Few Letters

  1. #1
    VBAX Regular
    Joined
    May 2007
    Posts
    72
    Location

    Solved: Hide Row Based On First Few Letters

    I need to hide a row in a range (8:40000) if the cell in column B begins with 2<= 50%, or with 3<= 80%.

    Also is there a way to hide all rows that are between the first row with 2<= 50% and last row with 3<= 80% (also first row with 4<= 100%).

    THANKS SO MUCH!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    What the heck is ... cell in column B begins with 2<= 50%, or with 3<= 80% ... supposed to mean?
    ____________________________________________
    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

  3. #3
    VBAX Regular
    Joined
    May 2007
    Posts
    72
    Location
    maybe its easier if I attach the file... the rows highlighted in yellow i would like hidden by running a macro, as would be using it on other reports...tx so much

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Xld is right! (naturally) if a cell begins with 2<= 50% then its a string (text) not a formula is this correct? what did you want to hide? all rows that are between the values or including the values?
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  5. #5
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    It would be easier if you attach a file!, maybe in the next post?
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Simon,
    See post #3
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Sub DeleteRows()
    Dim LastRow As Long
    Dim i As Long

    Application.ScreenUpdating = False

    With ActiveSheet

    LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
    For i = LastRow To 1 Step -1

    If .Cells(i, "B").Value Like "2<= 50%*" Or _
    .Cells(i, "B").Value Like "3<= 80%*" Then

    .Rows(i).Hidden = True
    End If
    Next i
    End With

    Application.ScreenUpdating = True
    End Sub
    [/vba]
    Last edited by Bob Phillips; 06-11-2008 at 03:12 PM.
    ____________________________________________
    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

  8. #8
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Quote Originally Posted by mdmackillop
    Hi Simon,
    See post #3
    lol Malcolm, that was an edit after i posted!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  9. #9
    VBAX Regular
    Joined
    May 2007
    Posts
    72
    Location
    YOU GUYS ROCK!


Posting Permissions

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