I have a sheet prefilled with data to match my destination sheet. I am using the following code to copy all the unlocked data cells to the destination sheet.
Sub Prefill()
If Sheets("Prefill").ProtectContents = True Then
Application.ScreenUpdating = False
Worksheets("Prefill").Activate
For i = 1 To 110
For j = 1 To 18
If Cells(i, j).Locked = False Then
a = Cells(i, j).Value
Worksheets("Cost Your Hemp").Activate
Cells(i, j).Value = a
Worksheets("Prefill").Activate
End If
Next j
Next i
Application.GoTo Worksheets("Cost Your Hemp").Range("B3")
Application.ScreenUpdating = True
End If
End Sub
This works fine as long as the destination sheet is unprotected. However I get an error (red text) when I protect the data entry cells in the destination sheet. Anyway to fix that?
Sub Prefill()
If Sheets("Prefill").ProtectContents = True Then
Application.ScreenUpdating = False
Worksheets("Prefill").Activate
For i = 1 To 110
For j = 1 To 18
If Cells(i, j).Locked = False Then
a = Cells(i, j).Value
Worksheets("Cost Your Hemp").Activate
Cells(i, j).Value = a
Worksheets("Prefill").Activate
End If
Next j
Next i
Application.GoTo Worksheets("Cost Your Hemp").Range("B3")
Application.ScreenUpdating = True
End If
End Sub
This works fine as long as the destination sheet is unprotected. However I get an error (red text) when I protect the data entry cells in the destination sheet. Anyway to fix that?