I'm trying to run a function within my Sub but am getting a compile error on the line x = NINOFunction() and am not sure how to get it working.
Sub CheckNINO()
Dim NINumber As Range, NINumbers As Range
Dim Usdrws As Long, x As Boolean
Usdrws = Worksheets("EeeDetails").Range("C" & Rows.Count).End(xlUp).Row
Set NINumbers = Worksheets("EeeDetails").Range("Q2:Q" & Usdrws)
For Each NINumber In NINumbers
x = NINOFunction(NINumber.Value)
If x = False Then
Range(NINumber).Copy Destination:=Worksheets("Validation").Cells(2, x)
End If
Next
End Sub
Function NINOFunction(sInp As String) As Boolean
Const s1 As String = "[AaBbCcEeGgHhJjKkLlMmNnOoPpRrSsTtWwXxYyZz]"
Const s2 As String = "[AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtWwXxYyZz]"
Const s3 As String = "######"
Const s4 As String = "[AaBbCcDd]"
NINO = sInp Like s1 & s2 & s3 & s4
End Function
The function is tested and works with a Boolean result.
If the result is False I want to copy the row across to a separate sheet.