teatimecrumpet
Active Member
- Joined
- Jun 23, 2010
- Messages
- 307
Hi,
I have two columns with values. I want to include some vba code that will search the first column for specific text values and if found then replace it with the value in the adjacent column and row's value.
The code below works but it takes some time to process.
Is there a way to use a formula for this? Because I could then use a filter and then replace the visible values in the column with a formual that would pull the adjacent cells values.
Also how would I incorporate "+1" in the below quoted code to use the found range +1 column? (just curious for this one)
Here is my code that works but it takes a bit of time.
THANKS!
I have two columns with values. I want to include some vba code that will search the first column for specific text values and if found then replace it with the value in the adjacent column and row's value.
The code below works but it takes some time to process.
Is there a way to use a formula for this? Because I could then use a filter and then replace the visible values in the column with a formual that would pull the adjacent cells values.
Also how would I incorporate "+1" in the below quoted code to use the found range +1 column? (just curious for this one)
Here is my code that works but it takes a bit of time.
Sub changetheunknown()
Dim I As Long
Dim LR As Long
Sheets("sheet1").Activate
With Sheets("sheet1")
LR = Cells(Rows.Count, 6).End(xlDown).Row
For I = LR To 2 Step -1
Select Case Range("F" & I).Value
Case "UNKNOWN"
Range("F" & I).Value = Range("G" & I)
Case "DEFAULT"
Range("F" & I).Value = Range("G" & I)
Case Else
End Select
Next I
End With
End Sub
THANKS!