Dear forum experts,

Need your guidance on the following requirements:

If column "JG" has "1" then macro has to run the below given IF conditions , otherwise, column "JG" should be blank "".

IF conditions:. "If Column Y <= Column AD" then Column JH should have a number of "1" automatically else should be blank "".

I have already written a code and it runs and gives the result as desired. But the code gives the value of "1" in all the cells of Column "JH", even "Column JG" has blank "".

Sub btwtwodates()

Range("JH2:JH200000").ClearContents

Dim StartRow As Long, Lastrow As Long
StartRow = 2
Lastrow = Sheet3.Cells(Sheet3.Rows.Count, 1).End(xlUp).Row

Dim sClass As String

For i = StartRow To Lastrow
dateoffirsttest = Sheet3.Range("Y" & i).Value
dateofconfirmation = Sheet3.Range("AD" & i).Value
numberofppw = Sheet3.Range("JG" & i).Value

If numberofppw = 1 Then GoTo newknownstatus

newknownstatus:

If dateoffirsttest <= dateofconfirmation Then
sClass = "1"
Else
sClass = ""
End If

Sheet3.Range("JH" & i).Value = sClass

Next

End Sub