A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Let me know once done so I assist you further.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello there,
I'm looking for some help in using VBA code on excel. I have several sheets set up so that when I select from a drop down, some information is copied to other sheets and the line is deleted from the 'Register'.
The problem - I have the sheets protected to prevent certain areas being changed/amended. The users are only able to fill certain areas of the sheets. This VBA code won't work when the sheets are protected. Any help would be greatly appreciated. The current VBA code is:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim rng As Range
Dim lastRow As Long
'Check if the changed cell is in column Z (Status)
If Target.Column = 26 Then
'Get the selected worksheet name
Set ws = Worksheets(Target.Value)
'Get the last row in the selected worksheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
'Copy the row to the selected worksheet
Set rng = Range("A" & Target.Row & ":D" & Target.Row)
rng.Copy ws.Range("A" & lastRow)
'Delete the row from the Register sheet
rng.Delete Shift:=xlUp
End If
End Sub
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Let me know once done so I assist you further.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
1 deleted commentComments have been turned off. Learn more