+ Reply to Thread
Results 1 to 3 of 3

Cannot get AllowEditRanges to loop through multiple worksheets

  1. #1
    Registered User
    Join Date
    03-21-2017
    Location
    Halifax, Nova Scotia
    MS-Off Ver
    2010
    Posts
    2

    Post Cannot get AllowEditRanges to loop through multiple worksheets

    I'm struggling on the "ws.Protection.AllowEditRanges.Add Title:="Classified", Range:=Range("AA:AA, AI:AR")" area as its prompting me to debug. The end goal of this would be to allow users to edit a certain ranges while protecting the rest of the sheet and allowing outlining and column/ row formatting as well.

    Sub Macro2()
    '
    ' Macro2 Macro
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets(Array("VP Primary Care & Pop Health", "VP Integrated Hlth Prog Care 1", "VP Integrated Hlth Prog Care 2", "VP Integrated Hlth Community"))
    ws.Protection.AllowEditRanges.Add Title:="Classified", Range:=Range("AA:AA,AI:AR")
    ws.EnableOutlining = True
    ws.Protect Password:="nshaforecast", UserInterfaceOnly:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True
    Next ws
    End Sub

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Cannot get AllowEditRanges to loop through multiple worksheets

    Not sure my post was right... let me check something...
    Yes my post was "barking up the wrong tree". Is this failing on the first try? or subsequent ones? You may need to remove the alloweditranges before setting them again, but I'm not very familiar with this.
    Last edited by Arkadi; 03-21-2017 at 10:35 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    03-21-2017
    Location
    Halifax, Nova Scotia
    MS-Off Ver
    2010
    Posts
    2

    Re: Cannot get AllowEditRanges to loop through multiple worksheets

    Hey, yeah its failing on subsequent tries, so I can run the Macro the first time - I'll try removing it on the next tries - thanks!

+ 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] For/Next loop for multiple worksheets
    By Excel_000 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-29-2015, 10:59 AM
  2. How to Loop Macro in Multiple Worksheets
    By chad411 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2014, 05:54 PM
  3. Loop for copying each row in one column into multiple worksheets
    By TagaExcel in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-01-2013, 04:32 PM
  4. Loop through multiple worksheets with Inputbox
    By treydott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2013, 12:43 AM
  5. worksheetfunction.countifs with loop from multiple worksheets
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 04:55 PM
  6. Running One Macro in Multiple Worksheets & Loop
    By mjali001 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2011, 04:57 PM
  7. Unable to Loop Multiple Worksheets
    By jackc in forum Excel General
    Replies: 4
    Last Post: 01-05-2006, 08:50 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