VBA Simple question
I apologize, the code should be shown as:
Public Sub assign()
Worksheets("Sheet3").Activate
Dim node As Integer
Dim xrow As Integer
node = 1
For xrow = 1 To 10000
If Range("b" & xrow).Value < 0 And range("b" & xrow).Value < range("b" &
xrow - 1).Value Then
Range("a" & xrow).Value = 33
End If
Next
End Sub
I feel that the range("b" & xrow - 1).value is causing the problem. How
should I write it?
"Shane" wrote:
I am looking to automate a cell comparison.
The code I have is as follows:
Public Sub assign()
Worksheets("Sheet3").Activate
Dim node As Integer
Dim xrow As Integer
node = 1
For xrow = 1 To 10000
If Range("b" & xrow).Value < 0 And Cells("b" & xrow).Value < Cells("b" &
xrow).Value Then
Range("a" & xrow).Value = 33
End If
Next
End Sub
I want to search through 10000 cells in column B and if the value is not 0,
and not equal to the previous cell, then enter "33". The figures are
arbitrary, but this is the task I need completed. Thanks for the help!
|