+ Reply to Thread
Results 1 to 3 of 3

VBA code (macro) to hide/unhide name ranges

  1. #1
    Registered User
    Join Date
    02-20-2019
    Location
    Riyadh
    MS-Off Ver
    Microsoft Office 2010
    Posts
    3

    VBA code (macro) to hide/unhide name ranges

    Dear Sir,

    I am working on a worksheet that has his hidden columns with name ranges. I want to hide/visible columns based on my name range in vba code. Novice to vba code please help to assign a macro for this sheet.
    Please Login or Register  to view this content.
    Above code is not working as expected, basically i want two macro code to move back and forth to visible columns only that refers to particular name ranges.

    Name ranges: Jan "AL:BP"
    Feb "BQ:CS" similarly untill
    Dec "ME:NH"
    please help me with the code, also find below link to the image of the file for reference



    Thank you,
    ibrmohTrip Report.JPG
    Last edited by alansidman; 12-28-2019 at 05:32 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 2019
    Posts
    16,609

    Re: VBA code (macro) to hide/unhide name ranges

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2013
    Posts
    3,298

    Re: VBA code (macro) to hide/unhide name ranges

    Is "Trips" your activesheet? If so, this might work better:
    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

+ 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