+ Reply to Thread
Results 1 to 6 of 6

Macro to Hide a Column with a relative position

  1. #1
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2003
    Posts
    11

    Macro to Hide a Column with a relative position

    I am trying to hide a column titled "Test". This column is usually olumn E, but it is possible it can be moved to column D or F. If I use

    Please Login or Register  to view this content.
    then column E is hidden, regardless of whether Test is moved left or right. The reason Test moves is due to the user inserting or deleting a column.

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

    Re: Macro to Hide a Column with a relative position

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Macro to Hide a Column with a relative position

    That works pretty well, thanks. One thing though, if it doesnt find test, it hides whatever column happens to be selected.

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

    Re: Macro to Hide a Column with a relative position

    You're welcome. Try.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to Hide a Column with a relative position

    Hi, zhavier,

    Please Login or Register  to view this content.
    Using objects is a better way to deal with this.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Macro to Hide a Column with a relative position

    Thanks a bunch, that works great, HaHoBe

+ 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. Macro that adds a sum after inserting a row to a relative position
    By tuff_fish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2014, 07:07 PM
  2. Syntax of integer object in relative column position
    By Daniell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2013, 06:32 AM
  3. Lookup a value, and SUM relative to that value position
    By gtichauer in forum Excel General
    Replies: 2
    Last Post: 01-17-2012, 04:44 PM
  4. Excel 2007 : Macro to fill in a relative position
    By OtisMardres in forum Excel General
    Replies: 3
    Last Post: 03-15-2011, 07:17 PM
  5. [SOLVED] Relative Cell position NOT working with or without macro
    By Scratching my Head in forum Excel General
    Replies: 6
    Last Post: 05-30-2005, 02: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