Results 1 to 15 of 15

Hiding Rows using VBA and the values within certain cells

Threaded View

  1. #1
    Registered User
    Join Date
    01-16-2012
    Location
    Winslow, England
    MS-Off Ver
    Excel 2007
    Posts
    9

    Hiding Rows using VBA and the values within certain cells

    Hi all, apologies for duplication.

    I am being driven slowly mad by my inability to get a simple piece of code working. I have a calendar that has days acroos the top and race series down the left. I want to be able to hide certain race series that I am not supporting this season by checking a box further down the sheet. For example, if I want to hide all of the rows that contain 'World Series', which is written in cell S161, I want to tick my check box next to this cell and have all rows that start with 'World Series' (in the A column range A1:A181) hidden. When the tick box is unticked, all the World Series rows are shown again.
    This code currently stops and shows a compile error, Next without For. The tick box link cell is X161

    I can supply the sheet if it helps, or a pdf of it so you can see what I am working on.

    Sub CheckBox9_Click()
    Application.ScreenUpdating = False
      With ActiveSheet
        If cell.Value("x161") = "TRUE" Then
       For Each cell In Range("A1:A181")
        If cell.Value = ("s161") Then
         cell.EntireRow.Hidden = True
        End If
        If cell.Value = "FALSE" Then
       cell.EntireColumn.Hidden = False
       Next
    Application.ScreenUpdating = True
    Range("C9").Select
    End Sub
    Last edited by Richard Buttrey; 01-23-2012 at 09:26 AM.

Thread Information

Users Browsing this Thread

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

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