vba to find cell in a column based on the value in another cell

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
683
Office Version
  1. 2016
Platform
  1. Windows
Hi,
Am after some vba if poss. to achieve the following:
In cell B2 in a wksheet named 'Report' I have a dropdown list. When I select a new entry from this list in B2 I would like some vba that goes to Column J in a wksheet named 'Data' and finds and selects the cell which has the same value I have selected in B2 in the 'Report' wksheet. There will be an exact match somewhere in Col J in 'Data'.
Any help much appreciated, thanks.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Make this code on the sheet when there is a change:

Code:
Sub FindValue()
dim row as long

row = application.worksheetfunction.match(range("B2").value, Worksheets("Data").Range("j:j"),0)
Worksheets("Data").activate
Range("J" & row").value

End sub
 
Upvote 0
Hi,
Thanks for coming back, it doesn't seem to like the syntax in the last row:
Range("J" & row").value
 
Upvote 0
ok, had to change the last bit to as follows:
Range("J" & row).Select
and it now works, thanks for your help :)
 
Upvote 0
Ugh. Its early and I'm waiting on slow code to run.

Sorry about that! Glad you got it working.
 
Upvote 0

Forum statistics

Threads
1,224,846
Messages
6,181,305
Members
453,031
Latest member
Chris_1

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