I want to make a loop in range to zero the offset cell if the cell data is repeated next As Below:
Col A Col B
T10 - 5
T20 - 10
T10 - 15
You see I have T10 Repeated maybe after one or many rows, What I want is to use only the last value for T10 (Which is 15 in this example) and make 5 = 0
I use this code in vb.net
But The Code Does not Sense that T10 = T10 to make the change
Appreciate your support, Thanks
Col A Col B
T10 - 5
T20 - 10
T10 - 15
You see I have T10 Repeated maybe after one or many rows, What I want is to use only the last value for T10 (Which is 15 in this example) and make 5 = 0
I use this code in vb.net
Code:
Private Sub AdjustTotalStoreWeightPerDiamater()
wb = Workbook Path ...
ws = Worksheet Name ...
lr = last row
Rng = Column Range
Cel = Column Range
i = integer
With ws
lr = .Range("A" & .Rows.Count).End(Excel.XlDirection.xlUp).Row
Rng = ws.Range("A2", "A" & lr)
End With
For i = 2 To lr
For Each Cel In Rng.Cells
If Cel.Value = Cel.Offset(-1, 0).Value Then
Cel.Offset(0, 3).Value = 0
End If
Next
Next
End Sub
Appreciate your support, Thanks