hello all, I'm working with 2 sheets, Before and After to track the dollar amount of changes made. basically in the before, if an operator under discloses an item and it's corrected by a reviewer in the after sheet, I want to track the cumulative changes made.
I basically need:
for the range from y3 through BM
if the before cell value < after cell value then
counter = counter + (before cell value-after cell value)
then display the counter value in a cell on sheet 3 or a message box.
I keep getting messed up on the syntax though. I have it like this:
Set searchrange = ws1.Range("y3:BM" & ws1LastRow)
Set ws2 = Sheets("Sheet2")
With ws2
ws2lastRow = .Range("Y" & .Rows.count).End(xlUp).Row
For i = 2 To ws2lastRow
counter = counter + (Sheet1.Cells("Y" & i).Value - Sheet2.Cells("Y" & i).Value)
Next i
End With
Sheet3.Cells(1, 1) = counter
End Sub
can someone please point me in the right direction? thank you for your help!!
paul
I basically need:
for the range from y3 through BM
if the before cell value < after cell value then
counter = counter + (before cell value-after cell value)
then display the counter value in a cell on sheet 3 or a message box.
I keep getting messed up on the syntax though. I have it like this:
Set searchrange = ws1.Range("y3:BM" & ws1LastRow)
Set ws2 = Sheets("Sheet2")
With ws2
ws2lastRow = .Range("Y" & .Rows.count).End(xlUp).Row
For i = 2 To ws2lastRow
counter = counter + (Sheet1.Cells("Y" & i).Value - Sheet2.Cells("Y" & i).Value)
Next i
End With
Sheet3.Cells(1, 1) = counter
End Sub
can someone please point me in the right direction? thank you for your help!!
paul