+ Reply to Thread
Results 1 to 2 of 2

Loop Action on Multiple Sheets Based on Sheet Names in a Range

  1. #1
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    Loop Action on Multiple Sheets Based on Sheet Names in a Range

    Hi,

    Is there VBA code I can use to loop the same action in certain sheets within a workbook (not all sheets, and I don't want to 'exclude' specific sheets). I'd like the code to go down a list of sheet names within a specified range. This way, if there are additional sheets I need to add later, I can just add it to the bottom of a range without having to edit a list of sheet names within the code. An incorrect version of the function is below:

    Sub SetProtectionPropertiesAsLockedinSheets ()

    Dim FcstSheetName as String

    Windows("2015 RF Macro.xlsm").Activate
    Range("H9").Select
    FcstSheetName = ActiveCell
    Windows("CLIENT - 2015 Q1RF.xlsx").Activate
    Sheets(FcstSheetName).Activate
    Cells.Select
    Selection.Locked = True
    Selection.FormulaHidden = False

    [...]

    In the '2015 RF Macro.xlsm' file, range H9:H15 lists names of sheets in the 'CLIENT - 2015 Q1RF.xlsx' workbook. Once it gets to the bottom of the list, I'd like it to move onto the next action in the code

    Hoping this isn't a difficult ask. I've Googled and couldn't find anything that does it the way I'm looking for.
    Let me know if my ask is unclear

    Thank you!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Loop Action on Multiple Sheets Based on Sheet Names in a Range

    Read post 2 in this thread:-

    http://www.excelforum.com/excel-prog...ml#post3904618

+ 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. Replies: 3
    Last Post: 10-01-2014, 01:49 PM
  2. [SOLVED] Macro to loop through multiple sheets and sum a certain range
    By Paul123qwe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-09-2014, 09:02 AM
  3. [SOLVED] loop action through all sheets in workbook skipping certain sheets
    By sawa85sa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2013, 06:40 PM
  4. Replicate range names in multiple sheets
    By brian55 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-22-2011, 10:41 AM
  5. Excel 2007 : Replicate range names in multiple sheets
    By brian55 in forum Excel General
    Replies: 1
    Last Post: 04-22-2011, 04:58 AM

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