Results 1 to 6 of 6

VBA to hide columns if criteria is met

Threaded View

esbencito VBA to hide columns if... 03-29-2018, 04:03 AM
davsth Re: VBA to hide columns if... 03-29-2018, 05:01 AM
Olly Re: VBA to hide columns if... 03-29-2018, 05:05 AM
PaulM100 Re: VBA to hide columns if... 03-29-2018, 05:06 AM
esbencito Re: VBA to hide columns if... 03-29-2018, 05:29 AM
davsth Re: VBA to hide columns if... 03-29-2018, 05:10 AM
  1. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: VBA to hide columns if criteria is met

    Or try:

    Sub HiddenColumns()
        HideShowColumns Range("A2:AD2")
        HideShowColumns Range("AE12:BG12")
    End Sub
    
    Sub HideShowColumns(columnsRng As Range)
        Dim c As Range
        For Each c In columnsRng.Rows(1).Cells
           If c.Value = "0" Then
                c.EntireColumn.Hidden = Not c.EntireColumn.Hidden
        End If
        Next c
    End Sub
    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. [SOLVED] VBA to hide columns based on criteria from 2 cells
    By Paul103 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-04-2016, 12:33 PM
  2. [SOLVED] Macro to Hide Columns in All Sheets based on criteria in Sheet1
    By toci in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 03-30-2016, 08:38 PM
  3. Hide pivot table columns based on date criteria
    By boontz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2014, 09:56 AM
  4. Code to show/hide columns based on fixed criteria
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2013, 03:39 AM
  5. Excel VBA Hide Duplicate Cell Contents If Two Columns Match Criteria
    By nnewburger in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2013, 01:08 PM
  6. hide rows -- criteria from multiple columns
    By nityesha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-19-2012, 07:05 AM
  7. Hide Columns based on criteria
    By gugg7378 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2011, 03:38 PM

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