Need modification to code....
Posted by travis on January 11, 2002 6:23 AM
I have two columns of data. I want to search column A for a specific value (X). When I find that value, I want to change the data in the same row but in column B to a different value (y). For example, when I find the number 22 anywhere in column A, I want the data in the same row, column B to be "hello".
I have this code and it works great! Though, I need a slight modification so I can select the column I want to search and the column I want to modify. This code will only allow me to replace information in the column next to my search column. I only do minimal programming so I don't understand all of what this code is doing. Any help would be awesome. Thanks!
Dim rng As Range
Set rng = Range([A1], [A65536].End(xlUp))
Application.ScreenUpdating = False
Columns(3).Insert
With rng.Offset(0, 2)
.FormulaR1C1 = "=IF(RC[-2]=22,""hello"",RC[-1])"
.Copy
.PasteSpecial Paste:=xlValues
End With
Columns(2).Delete