Hi there,

Apologies if this question has already been raised, I couldn't find it when searching the threads.

I have input a BeforeSave function which only seems to work for the first row of data input (which starts on row 4), which is understandable based on the range I have entered. Can anyone tell me how do I make it repeat for all rows, please?

This is my first ever use of VBA and I found the below code on a forum after much searching and tweaked it quite a bit to add 3 conditions. It works to do what I want it to - recognising input in A4 and making the subsequent row cells mandatory - but only for the first row. I need this to repeat for all rows, indefinitely.

My current code is as follows:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = False
If Trim(Range("A4")) <> "" Then
    If Trim(Range("B4")) = "" Then Cancel1 = True
    If Trim(Range("C4")) = "" Then Cancel1 = True
    If Trim(Range("D4")) = "" Then Cancel1 = True
    If Trim(Range("E4")) = "" Then Cancel1 = True
    If Trim(Range("F4")) = "" Then Cancel1 = True
    If Trim(Range("G4")) = "" Then Cancel1 = True
    If Trim(Range("H4")) = "" Then Cancel1 = True
    If Trim(Range("I4")) = "" Then Cancel1 = True
    If Trim(Range("J4")) = "" Then Cancel1 = True
End If

If Cancel1 = True Then MsgBox "You have begun a new record.  Please complete columns A to J, highlighted as mandatory."

If Trim(Range("M4")) <> "" Then
    If Trim(Range("N4")) = "" Then Cancel2 = True
    If Trim(Range("O4")) = "" Then Cancel2 = True
    If Trim(Range("P4")) = "" Then Cancel2 = True
End If

If Cancel2 = True Then MsgBox "You have input actions into Client Review Actions (column M).  Therefore, please fill in columns N, O and P, highlighted as mandatory."


If Trim(Range("P4")) = "Complete" Then
    If Trim(Range("Q4")) = "" Then Cancel3 = True
End If

If Cancel3 = True Then MsgBox "You have flagged this record as Complete (column P); please input the completion date into column Q, highlighted as mandatory."

End Sub
Many thanks in advance