+ Reply to Thread
Results 1 to 4 of 4

Limiting a Macro applied to only 1 worksheet in a file

  1. #1
    Registered User
    Join Date
    02-05-2022
    Location
    Framingham, MA
    MS-Off Ver
    365
    Posts
    3

    Limiting a Macro applied to only 1 worksheet in a file

    This script works well for my need, hiding specific columns, unfortunately it also hides columns in other worksheets in the same file. can anyone help me keep the macro focused on only one worksheet? The Sheet name i need it to work on is called "Member Data"

    Please Login or Register  to view this content.
    Last edited by AliGW; 11-27-2023 at 11:33 AM. Reason: Code tags added - please review the forum guidelines.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Limiting a Macro applied to only 1 worksheet in a file

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    02-05-2022
    Location
    Framingham, MA
    MS-Off Ver
    365
    Posts
    3

    Re: Limiting a Macro applied to only 1 worksheet in a file

    That worked great! but it seems to be a lot slower now, when it hides the identified columns it's now has a lot of blank columns on the right all the way to "XFD". Is there a way to limit the range and say only apply to columns A:RA?

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Limiting a Macro applied to only 1 worksheet in a file

    Hi again,

    As always, it's much easier for us to understand your requirements if you include a sample workbook and code - the code you posted has nothing to do with hiding columns.

    As posted, your original code should take longer to execute as it operates on every worksheet rather than on just one specific worksheet.

    If you give us some idea of the code you're using to hide columns we may be able to suggest something to speed up the process.

    Regards,

    Greg M

+ 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. Can DrawingObjects:=False be applied to a range instead of the entire worksheet?
    By Royzer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2017, 12:19 PM
  2. limiting the number of users in an Excel worksheet at a time
    By katkth7533 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2015, 12:45 PM
  3. Beforesave code applied to any file
    By sparent27 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-01-2014, 09:52 PM
  4. [SOLVED] Save file as CSV from XLS after VBA applied
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-05-2013, 05:10 PM
  5. Multi-Worksheet results needed with Rules applied
    By vortexkid in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-21-2012, 08:22 PM
  6. Limiting worksheet access through passwords
    By tvwhome in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-22-2010, 03:52 PM
  7. Can changes to a worksheet be applied to all wksheets in wkbook?
    By SandyM in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-18-2005, 02:05 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