v-lookup function

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,286
Office Version
  1. 2013
Platform
  1. Windows
Good Day,
Is it possible to run v-look up function for any cell with a code.
if the cell value changes the next row will be loaded automaticly with related info from another sheet.
the datas stored in sheet2 ,column"a" has the member id no's and column"b" has their names as well.
And if the user types the members id number on any cell in sheet1 the next row will be loaded with their names...
Many Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
try something like this; place this code in worksheet module;
Code:
[/FONT]
[FONT=Courier New]Private Sub Worksheet_Change(ByVal Target As Range)
 Application.EnableEvents = False
 ActiveCell.Value = Application.WorksheetFunction.VLookup(ActiveCell.Offset(-1, 0).Value, Sheets("Sheet2").Range("A1:B65000"), 2, 0)
 Application.EnableEvents = True
End Sub
 
Upvote 0
try something like this; place this code in worksheet module;
Code:
[FONT=Courier New]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
[FONT=Courier New]Application.EnableEvents = False[/FONT]
[FONT=Courier New]ActiveCell.Value = Application.WorksheetFunction.VLookup(ActiveCell.Offset(-1, 0).Value, Sheets("Sheet2").Range("A1:B65000"), 2, 0)[/FONT]
[FONT=Courier New]Application.EnableEvents = True[/FONT]
[FONT=Courier New]End Sub[/FONT]


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
 Application.EnableEvents = False
 ActiveCell.Value = Application.WorksheetFunction.VLookup(ActiveCell.Offset(-1, 0).Value, Sheets("Sheet2").Range("A1:B65000"), 2, 0)
 Application.EnableEvents = True
End Sub

Thanks Pedie,
Thats very good but how how we can change it to next right cell?like if entry d4 result will be on d5...
 
Last edited:
Upvote 0
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Application.EnableEvents = False
ActiveCell.Offset(-1, 1).Value = Application.WorksheetFunction.VLookup(ActiveCell.Offset(-1, 0).Value, Sheets("Sheet2").Range("A1:B65000"), 2, 0)
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top