HI..
I have made the following macro to clean up some data...
It successfully replaces "GR" with "KG" in the required place...
The thing i need help with is that I need (within that IF statement) .. it to also replace the adjacent cells (i,10) and (i,11) with "1" and "KG" respectively..
I'm stuck on this.. any help will be appreciated.. thanks
I have made the following macro to clean up some data...
It successfully replaces "GR" with "KG" in the required place...
The thing i need help with is that I need (within that IF statement) .. it to also replace the adjacent cells (i,10) and (i,11) with "1" and "KG" respectively..
I'm stuck on this.. any help will be appreciated.. thanks
Code:
Private Sub CommandButton1_Click()
Dim LR As Long, i As Long
Application.ScreenUpdating = False
LR = Range("I" & Rows.Count).End(xlUp).Row
For i = 1 To LR
If Right(Cells(i, 9).Value, 2) = "GR" And Cells(i + 1, 11).Value = "GR" Then
With Range("I" & i)
If Right(.Value, 2) = "GR" Then .Value = Left(.Value, Len(.Value) - 2) & "KG"
End With
Application.ScreenUpdating = True
End If
Next i
End Sub