+ Reply to Thread
Results 1 to 16 of 16

Hide specified columns via macro

  1. #1
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Hide specified columns via macro

    Hi,

    i want to hide specified columns in a WB.

    The macro should ask which columns i want to hide.
    These columns could be A,C,H or D, AA, AH.
    So i need a request from the macro with column i want to hide.
    This request should ask me as long i enter a name for a column.
    If i do not enter any more, the macro should hide the selected columns.

    Normaly the number of columns i have to hide is between 1 and 16.
    Please Login or Register  to view this content.
    but how is it possible to choose more than 1 column?

    Thank you

    kind regards
    Last edited by bluesurger; 05-19-2014 at 09:46 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Hide specified columns via macro

    Why not record a macro doing it, then look at the code?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    ? record a macro while a other macro is working?
    But i think i need a Loop which ask me for that until i do not enter any more column-name. Or isn't it so?

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Hide specified columns via macro

    No, record a macro hiding the columns and then stop recording and look at the code produced.

  5. #5
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    hy nathansav,

    the hide of the columns is working. But i have to start the macro for everz column i want to hide.
    So i think i should habe a loop in the code which does ask me untill i did not enter any more. Do you know what i mean?

  6. #6
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    @nathansav: How do you mean that?

    Do you really think it works as you said?

  7. #7
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    any otherone an idea?

    Thank you

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Hide specified columns via macro

    Does this help?

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    Hi John,

    no sorry.

    I need a InputBox on which i can enter my columns i want to hide.

    I use this solution at the moment>
    Please Login or Register  to view this content.
    With this ToggleB.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-28-2014
    Location
    N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Hide specified columns via macro

    Hi Bluesurger,

    On this workbook I have added a userform with each of the text boxes writing to a variable. These are then used to select which columns to hide. Let me know if it works for you

    Hide_Columns.xlsm

  11. #11
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    HY Mowgli

    i will test it tomorrow. thank you

  12. #12
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    Hi Mowgli,

    this macro works good. Thank You

  13. #13
    Registered User
    Join Date
    03-28-2014
    Location
    N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Hide specified columns via macro

    Your welcome, dont forget to mark the thread solved

  14. #14
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    Ok, before solve the thread one last question.

    What parts i have to change if i want to hide rows in the same way?
    Can i also use this code and put "row" instead of "Column" inside?

    Thank you

  15. #15
    Registered User
    Join Date
    03-28-2014
    Location
    N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Hide specified columns via macro

    The way it is set up in the form it is easier to modify the code slightly in a new form, I have done this and included both forms.

    The columns form took the letter entered in a text box, added a "1" to the end and selected the cell to hide the entire column

    Hide_Columns_Rows.xlsm

  16. #16
    Registered User
    Join Date
    05-16-2014
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Hide specified columns via macro

    Thank you it works pretty well

+ 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. [SOLVED] Macro; Hide Columns; VBA
    By overbomb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 09:36 AM
  2. Macro to Hide Columns Where Sum is Zero
    By mgordon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2013, 10:17 PM
  3. Macro to Hide Columns
    By Shazz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-24-2013, 10:32 AM
  4. hide columns macro
    By xkarenxxxx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-02-2006, 12:35 PM
  5. macro to hide columns
    By Shooter in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-27-2005, 05: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