lopiteaux
Board Regular
- Joined
- Jun 8, 2011
- Messages
- 77
Hi all - I'm a bit stuck with a fairly basic VLookup and was hoping someone could help. In short, what I want the VLookup to do is go down a list of values in column P, perform a VLookup using the primary key in column A on a seperate sheet in the workbook, and replace ONLY those values for which it finds the key.
The code I have at the moment returns the value if found and populates with "TEST IGNORE" if not found... I cannot seem to get the code to just skip to the next cell WITHOUT changing the value in the active cell...
Any ideas?
Thanks!
The code I have at the moment returns the value if found and populates with "TEST IGNORE" if not found... I cannot seem to get the code to just skip to the next cell WITHOUT changing the value in the active cell...
Code:
Sub UpdateValues()
Range("P1").Select
Do
ActiveCell.Value = Application.VLookup(ActiveCell.Offset(0, -15), Sheets("LOOKUPSOURCE").Columns("A:F"), 6, False)
If IsError(ActiveCell.Value) = True Then
ActiveCell.Value = "TEST IGNORE"
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Value = Application.VLookup(ActiveCell.Offset(0, -15), Sheets("LOOKUPSOURCE").Columns("A:F"), 6, False)
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell.Offset(0, -15).Value)
End Sub
Any ideas?
Thanks!