Results 1 to 20 of 62

Thread: VBA Code to Match US Region to the State that is entered

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #36
    Hi, I added the code to the MDS Equipment Detail Sheet in VBA but I keep getting an error once I protect the sheet.

    I need to unprotect the following when we enter the MDS Equipment Detail sheet. Allowing all VBA and Macros to run...

    Row 5 & 6 Certain Headers Columns CA - CL (I want to be able to change the names of the headers as needed

    Row 7 and on all fields to be open for running VBA and Macros..

    I am also looking to only copy the information from the MDS Equipment Detail Sheet to the MOST Add Sheet when a Client Name is filled in the Client Name column otherwise do not copy those rows..

    When I protect the MDS Equipment Detail sheet this is where the error goes too..

    With rMDS
    .Interior.Color = xlNone




    Quote Originally Posted by Paul_Hossler View Post
    Don't know what Jive is, but maybe don't use it

    To allow some cells to be updated when the sheet is protected, you need to make .Locked = False


    Option Explicit
    
    Sub ProtectMDS()
        With Worksheets("MDS Equipment Detail")
            If .ProtectContents Then Exit Sub
            Range(.Rows(1), .Rows(6)).Locked = True
            Range(.Rows(7), .Rows(.Rows.Count)).Locked = False
            .Protect Password:="password", UserInterfaceOnly:=True, DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingCells:=True, AllowDeletingRows:=True, AllowFiltering:=True
        End With
    End Sub
    
    
    Sub UnProtectMDS()
        With Worksheets("MDS Equipment Detail")
            If Not .ProtectContents Then Exit Sub
            .Unprotect Password:="password"
        End With
    End Sub
    Attached Files Attached Files
    Last edited by pawcoyote; 02-25-2017 at 11:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •