+ Reply to Thread
Results 1 to 10 of 10

Macro - hiding columns

  1. #1
    Registered User
    Join Date
    06-14-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    70

    Question Macro - hiding columns

    Hi, I created a very simple macro to hide a few columns in a worksheet, however, when I run the macro it hides more columns than I've asked it to. The macro should only hide columns F thru I, however, it hides B thru I. I've tried it several times, always with the same outcome. Anyone know how to fix this or know what I'm doing wrong?


    Please Login or Register  to view this content.
    Last edited by Koda7; 06-14-2010 at 11:34 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro - hiding columns

    Really? It doesn't for me.

    For info the code can be written as:

    Please Login or Register  to view this content.

    Please also use code tags when posting code to the forum.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro - hiding columns

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-14-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Macro - hiding columns

    Thanks for your help, I'm very new to this and macros in general. I was able to use the macro given above, however, I needed to add to it, and it didn't work. Let me tell you what I'm trying to accomplish and maybe someone can show me exactly what I need so I will know for the future.

    I have 5 tabs (Sheet 3 thru 8) that all have the same columns & rows. On those 5 tabs I want to create a macro to hide the following columns (B, F thru I, K, P thru AC),

    Then I'd like to create another macro that unhides those same columns.

    Thanks very much for any assistance you can give.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro - hiding columns

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-14-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Macro - hiding columns

    snb, I tried your code, but I received the following error: Compile error: Ambiguous name detected: enough.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro - hiding columns

    Then change the name into enoug0h

  8. #8
    Registered User
    Join Date
    06-14-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Macro - hiding columns

    That didn't work either, same error. I really don't understand why I keep getting errors. You'd think this wouldn't be that difficult.

  9. #9
    Registered User
    Join Date
    06-14-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Macro - hiding columns

    I tried this one, and I get: Compile error: Syntax error

    Please Login or Register  to view this content.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Macro - hiding columns

    Please Login or Register  to view this content.
    Last edited by shg; 06-14-2010 at 11:30 AM.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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