+ Reply to Thread
Results 1 to 7 of 7

Hide columns using Columns' number

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Hide columns using Columns' number

    Hello
    Can I know if it possible to hide columns using their number or not?
    I know how to hide just one column
    Please Login or Register  to view this content.
    But when trying to do that line I have an error
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Hide columns using Columns' number

    Hi,
    To my knowledge, you will have to use a loop if you want to use the column numbers, like this :

    Please Login or Register  to view this content.
    Note: Using the Array allows you to skip columns, example : 4, 5, 9, 12, ...
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    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,093

    Re: Hide columns using Columns' number

    Maybe this way:

    Please Login or Register  to view this content.

    Regards, TMS
    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


  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Hide columns using Columns' number

    Quote Originally Posted by GC Excel View Post
    Hi,
    To my knowledge, you will have to use a loop if you want to use the column numbers, like this :

    Please Login or Register  to view this content.
    Note: Using the Array allows you to skip columns, example : 4, 5, 9, 12, ...
    Great idea to to the task thank you very much

    Mr. TMS can I ask why 12-3 why don't you use 9 directly? I tested 9 and worked as well ..

  5. #5
    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,093

    Re: Hide columns using Columns' number

    Mr. TMS can I ask why 12-3 why don't you use 9 directly? I tested 9 and worked as well ..
    Yes, I did use 9 directly but thought that "12 -3" might be more indicative of which was the end column number. That is, the column number you want to go up to minus the last visible column. Other than that, I was left counting on my fingers.

    If you choose to use the array method, you might want to include
    Please Login or Register  to view this content.
    Regards, TMS





    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Hide columns using Columns' number

    Thanks Mr TMS for sharing your way of thinking . I'm admired of your way and I want to learn more from you. You are a big source for such a beginner as me

  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,093

    Re: Hide columns using Columns' number

    You're welcome. Thank you for your kind words.

+ 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. VBA code to hide filtered columns (simple table 5 rows / 6 columns wide)
    By e2010 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2014, 02:41 PM
  2. sorting columns based on row criteria, with variable number of columns
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-02-2014, 04:02 PM
  3. Dropdown box to hide various number of columns
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2012, 05:57 PM
  4. Hide specific columns dependant on number in specific cell
    By ladbroke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 04:46 PM
  5. Replies: 4
    Last Post: 03-15-2010, 05:01 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