O
oercim
Hello, I have a problem with my vba code,, which compares the values of first and second columns. And if value of first column is smaller than the second one, assigns "1" to third column.
However, if one of the cells is not numeric code stops to work and gives error. Unfortunately some of my cells have to be string. In that situation I just want to pass that row. How can I do it? I couldn't manage it. My codes are as below:
For i = 1 To 100
If Sheets("Sheet1").Cells(i, 1) < Sheets("Sheet1").Cells(i, 2) Then
Sheets("Sheet1").Cells(i, 3) = 1
Else
Sheets("Sheet1").Cells(i, 3) = 0
End If
Next
I will be very glad if you help me. Thanks a lot.
However, if one of the cells is not numeric code stops to work and gives error. Unfortunately some of my cells have to be string. In that situation I just want to pass that row. How can I do it? I couldn't manage it. My codes are as below:
For i = 1 To 100
If Sheets("Sheet1").Cells(i, 1) < Sheets("Sheet1").Cells(i, 2) Then
Sheets("Sheet1").Cells(i, 3) = 1
Else
Sheets("Sheet1").Cells(i, 3) = 0
End If
Next
I will be very glad if you help me. Thanks a lot.