Create macro to search for a cell value

Closed
jesanicholls
Posts
1
Registration date
Tuesday May 28, 2013
Status
Member
Last seen
May 28, 2013
- May 28, 2013 at 01:53 PM
TrowaD
Posts
2886
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
June 27, 2022
- May 30, 2013 at 10:43 AM
I have 2 separate excel (2010) workbooks I'm working with and I would like to create a macro that, when run, will copy a variable value that is in cell J1 in workbook 1, and search workbook 2 for that value.

I've tried recording a macro that uses the search box but it doesn't consider the variable value of J1, and always enters the value that the macro was initially recorded with.

Please Help!

1 reply

TrowaD
Posts
2886
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
June 27, 2022
515
May 30, 2013 at 10:43 AM
Hi Jesanicholls,

First we need to specify the search value.
Start code with:
Dim sValue As String
sValue = Range("J1").Value

Then look for the Cells.Find part of the code and change the text found after What:= into sValue.

If you need further assistance then post your code along with your question.

Best regards,
Trowa
0