Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change event Macro
I have recorded a macro that I currently run via Tools/Macro/Macros/Run. It
works fine but it is cumbersome to go throught that process. I could run it on a toolbar button but what I really need is for it to run when a certain word "Airport RV" is entered into a specific cell on a data entry sheet. This cell G7:G26 is used to enter data that is moved to a specific sheet via a vlookup formula. I have concluded that a Change Event is probibly the way to go to activate this macro, but I have no skills to make the connection. Any help would be appreciated. Mike Rogers |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change event Macro
I believe this will probably help you out:
Private Sub Worksheet_Change(ByVal Target As Range) Dim iSect As Range Set iSect = Application.Intersect(Range(Target.Address), Range("G7:G26")) If iSect Is Nothing Then Exit Sub ' End If Application.EnableEvents = False If UCase(Trim(Target.Value)) = "AIRPORT RV" Then 'your existing macro code here End If Application.EnableEvents = True End Sub note that it goes into the Worksheet's _Change() event. Change "G7:G26" to the exact addresses where you want to look for "Airport RV" to be entered. That way it won't eat up too much time checking every time you change something on the sheet - the Application.Intersect will prevent even the test from being executed unless a change has been made in one of those cells. The UCase(Trim(Target.Value)) strips off leading and trailing white space and converts to all uppercase for comparison, so it is case insensitive. "Mike Rogers" wrote: I have recorded a macro that I currently run via Tools/Macro/Macros/Run. It works fine but it is cumbersome to go throught that process. I could run it on a toolbar button but what I really need is for it to run when a certain word "Airport RV" is entered into a specific cell on a data entry sheet. This cell G7:G26 is used to enter data that is moved to a specific sheet via a vlookup formula. I have concluded that a Change Event is probibly the way to go to activate this macro, but I have no skills to make the connection. Any help would be appreciated. Mike Rogers |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
error when running cut & paste macro | Excel Worksheet Functions | |||
Macro To Change Cell Color When Value Changes | Excel Worksheet Functions | |||
Macro broken with workbook name change | Excel Discussion (Misc queries) | |||
event macro on a condition | Excel Discussion (Misc queries) | |||
how do i change the expense statement template macro | Excel Worksheet Functions |