I am trying to construct a macro that is available when a sheet is opened to identify when a particular cell is reached (or value of another cell changes). Then run a message box to ask the user if they wish to record the information they have just entered. Currently the code executes when the sheet is opened as well as when the cell is reached, I only want the message box to appear if a particular cell is active.
Run Macro when specific cell reached
-
-
-
Re: Run Macro when specific cell reached
Hi,
Welcome to the Forum.
Try:
Data-Validation - Input Message
Here you type the msg and also you can give a title to it. This message will be displayed whenever the
Cell is selectedHTH
-
-
Re: Run Macro when specific cell reached
Thanks for the suggestions,
I have tried inserting your suggested code before the code I already had but the message box still pops up when the sheet is opened - did I misunderstand your suggestion?
-
Re: Run Macro when specific cell reached
Take out the line
from your original code. You may have to slightly adjust your your code.
I have to run now but I'll check back in an hour or so to see if you've gotten it. If you still need help then, I may have some extra time
-
-
Re: Run Macro when specific cell reached
I am not sure that this is what you are looking for
CodePrivate Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$H$10" Then If UCase(Target.Value) = "Y" Then MsgBox "This is updated" End If End If End Sub
The way I read your question is
1. You are trying to ask a user to validate their entries when a threshold is reached
2. Open a msgbox when a cell is activated - The code above does thisIs that right? Can you post an example workbook?
-
Re: Run Macro when specific cell reached
Thanks for your suggestions but I still have not been able to overcome the original problem Doh!
I attach examples of the 2 files I am using - Job.xls and Master.xls
'Job' (needs to be converted to template) is opened as a template and entries are made in row 10, tabbing to the next cell after entries are made in the current cell. When Cell H10 is reached a message box should pop up asking the user if they wish to post the entries they have made. Answering 'yes' here will then run a macro to take the entries and add them to the workbook 'Master.xls' insert a row at A10 and continue with further entries.
Currently when you open 'Job' the message box that I don't wan't to appear until you reach cell H10 pops up and has to be cancelled before data can be entered.
Hope this is helpful.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!