+ Reply to Thread
Results 1 to 2 of 2

VBA Help | Hiding Rows based on Strings

Hybrid View

maintguy VBA Help | Hiding Rows based... 08-05-2012, 01:19 PM
xladept Re: VBA Help | Hiding Rows... 08-05-2012, 01:44 PM
  1. #1
    Registered User
    Join Date
    07-09-2012
    Location
    Indiana
    MS-Off Ver
    Excel 2010
    Posts
    8

    VBA Help | Hiding Rows based on Strings

    Hello all,

    I am currently having issues with running a VBA sub in which I desire it to have the capability of hiding rows based off strings... my spreadsheet has tasks based off frequencies "weekly", "biweekly", "monthly" .... etc. all the way up to the second to last row which reads "additional notes".. I have command buttons for the different frequencies. I desire to be able to click "weekly" which would then hide all the tasks up until the row "additional notes." The code runs but nothing happens.. Any tips?

    Sub weekly()
    Dim LoopCell As Range
    Dim CellRange As Range
    Dim CellValue As String
    
    
    Set CellRange = Range("A1:A100")
    For Each LoopCell In CellRange
    If CellValue = "BIWEEKLY" Then
    Do
    LoopCell.Value = CellValue
    EntireRow.Hidden = True
    Loop Until CellValue = "ADDITIONAL NOTES"
    End If
    Next LoopCell
    
    End sub
    Any help is appreciated.
    mg
    Last edited by Cutter; 08-05-2012 at 03:03 PM. Reason: Added code tags

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Help | Hiding Rows based on Strings

    Hi maintguy,

    Try this:

    Sub weekly()
    Dim LoopCell As Range
    Dim CellRange As Range
    
    Set CellRange = Range("A1:A100")
    For Each LoopCell In CellRange
    If LoopCell.Value = "BIWEEKLY" Then
    Do Until CellValue = "ADDITIONAL NOTES"
    EntireRow.Hidden = True
    Loop 
    End If
    Next LoopCell
    
    End Sub
    Last edited by xladept; 08-05-2012 at 02:08 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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