Hi All,
I am trying to write a code that will change the value in Column I if Column K has value "Orange" to "Fruit". But I also want the value of the next cell down in Column I change to "Fruit" as well.
My macro below only works when I have one singular value change but not multiple. Could you please help?
For example: desired result is if Column K3 = "Orange" then Column I3 & I4 = "Fruit". I have about 300 lines of data to go through. Thank you for your help!!!!
Code
Sub test()
Dim LastRow As Long
Dim i As Long
LastRow = Range("K" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Range("K" & i).Value = "Orange" Then
Range("I" & i).Value = "Fruit" And Range("I" & i).Offset(1, 0).Value = "Fruit" 'the statement works only if I have first value met; I want value change down from the first cell in Column I to "Fruit" as well. I get type mismatch error everytime I ran this statement.
End If
Next i
End Sub
Display More