+ 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
    18

    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, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    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.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    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)

Similar Threads

  1. [SOLVED] Which below code, I can Hide & unhide, but I want only allow to HIDE
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2016, 04:10 AM
  2. [SOLVED] Different ranges for hide/unhide with vba code
    By Immortal2014 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2015, 06:07 AM
  3. Hide Visibility hide and unhide menu using macro ?
    By jasond1992 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2015, 09:05 PM
  4. [SOLVED] Specific macro or VBA code to hide and unhide rows
    By louvaek in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-17-2014, 07:36 AM
  5. Need to Hide/Unhide Rows and Columns Based on Several Date Ranges
    By zlorinc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 04:32 PM
  6. [SOLVED] Hide Unhide Code
    By ando185 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 01:22 PM
  7. VBA code to hide/unhide columns
    By radline2006 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-08-2011, 05:44 PM

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