Change value after lookup

  • Thread starter Secret Squirrel
  • Start date
S

Secret Squirrel

I have two worksheets in my file. I have a value in sheet1 in cell AN2 that I
need to lookup on sheet2 in column AF. When it finds a match I then need to
change the value in column N on Sheet2 for the row it found the value in. How
can I write vba code to fire this code?
 
J

jamescox

Assuming you want the code to run when the user changes the Sheet1!AN2
cell value, you will probably want to use Sheet1's Worksheet_Change
event.

Take a look at the help files and see if that looks like it will work -
you'll need to check if the Target range in that event is AN2 (possibly
by comparing the Target.Address with "AN2" = or "$AN$2" - check which
format the Target.Address returns) and run your code if it is or exit
the sub if the change wasn't in AN2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top