Results 1 to 1 of 1

Delete Protection.AllowEditRanges

Threaded View

wulffjp Delete... 03-20-2009, 06:24 PM
  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    Denver, CO
    MS-Off Ver
    Excel 2003
    Posts
    1

    Delete Protection.AllowEditRanges

    Hello,

    I'm trying to loop through a series of worksheet and delete any protection.AllowEditRanges the worksheet may have. The problem is that the edit ranges are deleted on the 1st workbook, but not the subsequent workbooks. Any help would be greatly appreciated. Thanks, Johnell

    Sub DeleteCreateEditRanges()
    
    Dim numWkStCount As Integer     'worksheet count
    Dim numFGWrkShtCount As Integer      'functional group worksheet count
    Dim numStartWrkSht As Integer
    Dim intW As Integer
    Dim intN As Integer
    Dim string1 As String
    Dim rng As AllowEditRange
    
    'Get Number of worksheets
    numWkSCount = Worksheets.Count
    'Set last workhsheet to modify as last functional group sheet
    numFGWrkShtCount = numWkSCount - 2
    'Set first worksheet to add allow edit ranges as first functional group worksheet
    numStartWrkSht = 4
    
    For intW = numStartWrkSht To numFGWrkShtCount
    
        intN = Worksheets(intW).Protection.AllowEditRanges.Count
        string1 = Worksheets(intW).Name
        If Worksheets(intW).Protection.AllowEditRanges.Count > 0 Then
            MsgBox "Allow Edit Ranges = " & intC, vbInformation, "Worksheet " & Worksheets(intW).Name
    
            For Each rng In Worksheets(intW).Protection.AllowEditRanges
                rng.Delete
            Next rng
        End If
    Next intW
    End Sub
    Last edited by wulffjp; 03-20-2009 at 06:34 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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