Results 1 to 10 of 10

Hide & Unhide columns based on a cell value

Threaded View

  1. #1
    Registered User
    Join Date
    02-21-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    40

    Talking Hide & Unhide columns based on a cell value

    Hello everyone,

    I have a particular problem with a worksheet I am working on at the moment, basically if row 5 has a 0 displayed I want that column to hide, but if row 5 has text of any value displayed I want it to unhide, the range is E5 to BA5 across.

    I have draft VBA code as follows:

    Sub HideColumn()
        Application.ScreenUpdating = False
        Application.Calculation = xlCalculationManual
        For a = 0 To 50
        If Range("E5").Offset(0, a).Value = "Hide Column" Then Range("E5").Offset(0, a).EntireColumn.Hidden = True
        Next a
        Application.ScreenUpdating = True
        
        
    End Sub
    This works to an extent in that it will hide the columns with the 0 displayed, but when I unhide them the word TRUE is input in other blank cells, and also if text is input for the hidden rows they do not unhide...
    Last edited by teylyn; 02-21-2010 at 06:52 AM. Reason: changed quote to code tags

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