I want my Excel sheet to track my input.
For example, when I enter something like ID and pressed the ENTER key, it will look up that ID in another sheet and found a NAME and replace the ID in the original cell where I input.
Is VBA ok to do this?
Simple example would be good, thank you.
Update:
Yes of course, only some certain cells I will enter the IDs so not the whole sheet need to be tracking.
Use the
Worksheet_Change(ByVal Target As Range)event handler (defined for a worksheet) for your task. This function will be called each time when a cell value of that worksheet has changed (by the user or by other vba code).The
Targetparameter contains the range of cells that have been changed. Now iterate over the columns and rows in that range and perform the lookup/replace operation you want to do. Ensure with an additional Boolean variable that the event handler doesn’t invoke itself.That should be all you need.