I'm trying to create a macro where if column Q4 is less than 20, column S4 should show N and if column Q4 is between 20 to 30 and is more than 5,000,000, column S4 should show y and if not N and if column Q4 is more than 30, column S4 should show Y. This function should repeat till the last non blank row of Q.
I'm not sure why my codes are not working even for the 1st row and I have no idea how to continue till the last row. Someone help please. Thank you
I'm not sure why my codes are not working even for the 1st row and I have no idea how to continue till the last row. Someone help please. Thank you
Code:
Dim score As Long, result As String
Set Age = Range("Q4").Number
Set amt = Range("K4").Number
If Age <= 20 Then
result = "N"
If Age > 20 And Age <= 30 And amt > 5000000 Then
result = "Y"
Else
result = "N"
If Age > 30 Then
result = "Y"
Range("S4").Value = result
End If
End If
End If
Last edited by a moderator: