View Single Post
 
Old 07-25-2013, 06:14 PM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Hi, Phil. I came here more than a month later to ask a question myself, and thought I'd look over some of these. I'm sorry no one has offered you what seems to me an obvious solution: Have you tried using a macro that runs automatically whenever any value on that worksheet has changed?

In general, VBA programs that are triggered by events in Office apps are named <Object-name>_<Eventname>, for example "Button1_Click" or "Form_Open". In this case you want, I think, "Worksheet_Change", like this:

Private Sub Worksheet_Change(ByVal ChangedCell As Range)
MsgBox "You put a new value in some cell on row " & ChangedCell.Row & "."
End Sub

You must include the specified parm as listed above, though you can name it whatever you like. You put this code not in a regular code module but in the code for the related worksheet. After that, whenever you enter a value on that worksheet, Excel will set your argument to the the cell object that was changed, and run the program.

In this case you want your program to check the address of the changed cell. If it's not column A then just Exit Sub without comment, and the user will never be bothered with it. Otherwise set the adjacent cell based on the new value in the changed cell. Clear?

Whenever I test this, I discover some pesky reason why the macro won't fire, and it's always some reason I forgot about since the last time I did this kind of thing. (I don't have to do it very often, so I forget each time.) Let me know if you have trouble of that kind, and I'll try to find an article listing some of the obvious reasons. Just now it turned out Application.EnableEvents was set to False for some reason; I just turned it back on and it worked great.
Reply With Quote