+ Reply to Thread
Results 1 to 8 of 8

Hide colums

  1. #1
    Registered User
    Join Date
    01-08-2015
    Location
    Australia
    MS-Off Ver
    Mac 2011
    Posts
    75

    Hide colums

    Hi,

    I am trying to hide columns that are defined by named ranges using VBA. I want it to be dependant on the number in C2. C2 will contain a number from 0-6 as well as 2 letters e.g. 0AJ, 3ST. Some columns may already be hidden so I'm not sure if I need to have a 'show all' at the beginning. I know the code below isn't complete or correct but hopefully it helps you to understand what I'm looking to do.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Hide colums

    Maybe (untested):

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-08-2015
    Location
    Australia
    MS-Off Ver
    Mac 2011
    Posts
    75

    Re: Hide colums

    Thanks TMS but it doesn't like:

    If C2 contains "0" Then

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Hide colums

    That's the one bit I didn't change.




    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    01-08-2015
    Location
    Australia
    MS-Off Ver
    Mac 2011
    Posts
    75

    Re: Hide colums

    Hopefully the attachment helps. The beginning sheet has all columns visible. The other sheets are the different views with columns that are hidden depending on the number in C2.
    Attached Files Attached Files

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Hide colums

    OK, try this:

    Please Login or Register  to view this content.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Hide colums

    Thanks for the rep.

  8. #8
    Registered User
    Join Date
    01-08-2015
    Location
    Australia
    MS-Off Ver
    Mac 2011
    Posts
    75

    Re: Hide colums

    No problem. Any idea on this issue resulting from hiding the columns?

    https://www.excelforum.com/excel-for...ml#post5612550

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide and Show Colums using VBA
    By Aisha890 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2016, 07:28 AM
  2. Hide Colums before current date
    By pulsarman605 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2014, 06:11 PM
  3. Macro to hide colums
    By mohk123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-24-2013, 01:04 AM
  4. [SOLVED] Hide non ajacent colums with a Macro
    By Shazz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-01-2013, 09:54 AM
  5. freeze first colums and hide one colums
    By pejoi in forum Excel General
    Replies: 2
    Last Post: 08-09-2012, 03:50 AM
  6. Macro to Hide Colums
    By keen learner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2006, 08:10 AM
  7. How can I hide data in colums.
    By Gord in forum Excel General
    Replies: 4
    Last Post: 06-01-2005, 04:05 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