I have 2 worksheets in the same workbook that are protected with the same password. The Sheet "SEARCH" allows me to select information and post it to the sheet named "PRICE SHEET" When I run the command button the codes wont work when protected. The coding below seems to work when only the "PRICE SHEET" is not protected .
The sheet "SEARCH" allows me to enter "select" in Column D then selects a code in Column A and transfers that to the next available row on "PRICE SHEET" Column "B" starting at cell "B9". I have tried lots of combinations of coding but no joy, I have managed to work out codes on other worksheets but this has got me stumped. Any help would be very much appreciated.
Regards Rob
The sheet "SEARCH" allows me to enter "select" in Column D then selects a code in Column A and transfers that to the next available row on "PRICE SHEET" Column "B" starting at cell "B9". I have tried lots of combinations of coding but no joy, I have managed to work out codes on other worksheets but this has got me stumped. Any help would be very much appreciated.
Regards Rob
VBA Code:
Private Sub CommandButton3_Click()
Dim i, LastRow
LastRow = Sheets("SEARCH").Range("D" & Rows.Count).End(xlUp).Row
Sheets("PRICE SHEET").Range("B9:B300").ClearContents
For i = 2 To LastRow
If Sheets("SEARCH").Cells(i, "d").Value = "select" Then
Sheets("SEARCH").Cells(i, "a").Cells.Copy Destination:=Sheets("PRICE SHEET").Range("b" & Rows.Count).End(xlUp).Offset(1)
Worksheets("PRICE SHEET").Activate
End If
Next i
End Sub