ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Change value after lookup (https://www.excelbanter.com/excel-discussion-misc-queries/235500-change-value-after-lookup.html)

Secret Squirrel

Change value after lookup
 
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?

jamescox[_13_]

Change value after lookup
 

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.


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=111601


Secret Squirrel

Change value after lookup
 
Do you mean look at the help file for the Worksheet Change Event?

"jamescox" wrote:


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.


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=111601




All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com