Results 1 to 2 of 2

VBA to hide columns based on a cell value

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-09-2015
    Location
    malta
    MS-Off Ver
    Microsoft 365
    Posts
    387

    VBA to hide columns based on a cell value

    Hi all,

    I would like to ask whether someone can help me with the below.

    I am trying to have a number of column hidden depending on the value in a particular cell. For ease of reference I have attached a sample.

    Sub HideColumn_Jan()
    
    
    
        If Sheets("2015").Range("A5").Value = January Then
            Columns("A:D").EntireColumn.Hidden = False
            Columns("D:F").EntireColumn.Hidden = True
            Columns("G:BN").EntireColumn.Hidden = False
       
         
         
        End If
        
     End Sub
    However the code doesn't seem to be working. Can someone please help me out

    Appreciate a lot your kind help!

    Thank

    Keibri
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide Rows/Hide Columns Based on Value in Cell
    By brickwall823 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2015, 02:42 PM
  2. hide and unhide columns based on cell value
    By darijokesar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-29-2014, 03:51 AM
  3. Hide columns based on cell value
    By jwillis07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2014, 06:57 AM
  4. Hide columns based on cell value
    By jwillis07 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2014, 04:59 AM
  5. [SOLVED] Hide columns based on specific cell value
    By samcdavies in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2013, 05:53 AM
  6. Hide columns based on value in other cell
    By Johnmus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2011, 04:21 PM
  7. [SOLVED] Hide columns based on cell value
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 06-23-2005, 01:05 PM

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