Private Sub commandbutton2_click()
Dim c1 As Range, c2 As Range, wk As String, x As Integer
wk = "WEEK " & Worksheets(1).Range("K2")
For x = 14 To 17
Set c1 = Worksheets(wk).Range("C5:I5").Find(Worksheets(1).Range("G2"), LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False)
Set c2 = Worksheets(wk).Range("B6:B55").Find(What:=Worksheets(1).Cells(2, x), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False)
ActiveSheet.Unprotect "national"
If c1 Is Nothing Or c2 Is Nothing Then
MsgBox "No Match"
Else
If Worksheets("PAY CALCULATOR").Cells(2, x)<> "" Then
If Worksheets(wk).Cells(c2.Row, c1.Column)<> "" Then
ans = MsgBox("You are about to overwrite a current total! Proceed?", vbYesNo, "Confirmation")
If ans = vbNo Then Exit Sub
End If
Worksheets(wk).Cells(c2.Row, c1.Column) = Worksheets(1).Cells(59, x)
End If
End If
Next x
Range("b5:b57,e5:e15,e17:e19,e22:e23,e29:e37,E39:E43,e52:e55,H5:h15,h17:h19,H22:h23,h29:h37,h39:h43,h54,k5:k15,K17:k19,k22:k23,K29:k37,k39:K43,n58,o58,p58,q58,N2,O2,P2,Q2").ClearContents
Range("N2").Select
ActiveSheet.Protect "national"
End Sub