Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello!
I received assistance in an earlier post that helped tremendously, but I'm having an additional problem with the code I received. Situation: I import a 3 column list into a worksheet in Excel. On several other sheets, I run a VLOOKUP code in VBA to auto-enter data. When certain criteria is entered in cell A1, VLOOKUP enters the corresponding results into the same row into B1 and C1. I'm using the following code: Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range, res As Variant If Target.Address = "$A$1" Then Set rng = Worksheets("Sheet2").Range("A1:C1800") res = Application.VLookup(Target, rng, 2, False) If IsError(res) Then Range("B1:C1").Value = "Manual Entry Required" Else Range("B1").Value = res Range("C1").Value = Application.VLookup(Target, _ rng, 3, False) End If End If End Sub This code only targets cell A1 on the current worksheet. I need it to target about 100 rows of column A so if the data entered in cell A55 is different than the data entered in cell A1, it returns the proper info for data entered in A55. I've tried using several Target.Range codes, to no avail. Any help would greatly be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VLOOKUP in VBA code | Excel Programming | |||
vlookup in vba code | Excel Programming | |||
Using Vlookup in VBA code | Excel Programming | |||
Vlookup in VB code | Excel Programming | |||
Help with Vlookup code | Excel Programming |