i am using this code:
Private Sub DAYREQUESTTB_Change()
Dim i As Integer
Dim DaysRequest As Integer
Dim DaysRemaining As Integer
Dim ThisCell As Range
For Each ThisCell In Range("C1:C100,G1:G100,K1:K100,O1:O100,S1:S100,W1:W100,AA1:AA100,AE1:AE100,AI1:AI100,AM1:AM100,AQ1:AQ100,AU1:AU100,AY1:AY100,BC1:BC100")
If ThisCell.Value = DAYREQUESTTB.Value Then
i = ThisCell.Row
Exit For
End If
DaysRemaining = Cells(i, 6).Value
DaysRequest = InputBox("Welcome " & DAYREQUESTTB.Value & ". You are entitled to " & Cells(i, 4).Value & " days off. You have used " _
& Cells(i, 5).Value & " days off and have " & DaysRemaining & ". Please enter the number of days you are requesting", "Welcome " & DAYREQUESTTB.Value)
If DaysRequest > DaysRemaining Then
MsgBox "You only have " & DaysRemaining & " days left. Your request has exceeded this amount.", vbOKOnly + vbCritical, "Error"
Exit Sub
End If
Cells(i, 5).Value = Cells(i, 5).Value - DaysRequest
End Sub
and i get this message:
Compile Error:
For without Next