Run a macro when cell value changes

I have a macro that I would like to run, onlly when a particular cel
value reaches a pre-defined value.

I really do not know how to do this - I have looked on help features
but to no avail.  any ideas

--
Message posted from http://www.ExcelForum.com

0
7/21/2004 4:36:40 PM
excel.misc 78881 articles. 5 followers. Follow

8 Replies
618 Views

Similar Articles

[PageSpeed] 6

right click sheet tab>view code>copy/paste this>modify to suit>save
Now when cell c1 calculates to >32 your macro will fire

Private Sub Worksheet_Calculate()
If Range("c1") > 32 Then  call yourmacro   ' MsgBox "Hi"
End Sub

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Emea training >" <<Emea.training.19r5v2@excelforum-nospam.com> wrote in
message news:Emea.training.19r5v2@excelforum-nospam.com...
> I have a macro that I would like to run, onlly when a particular cell
> value reaches a pre-defined value.
>
> I really do not know how to do this - I have looked on help features,
> but to no avail.  any ideas?
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
Don
7/21/2004 4:51:04 PM
:

--
Message posted from http://www.ExcelForum.com

0
7/21/2004 5:38:34 PM
Great answer, 
I have a little bit near question, is it possibl
to do it without having any number, if i enter into a particular  blan
cell say 'J2',  to activate the macro or run the macro. 
thank u.
nowfa

--
Message posted from http://www.ExcelForum.com

0
7/21/2004 6:21:32 PM
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Address = "$B$3" Then
If Target.Value > 100 Then
    Call macroname
        End If
    End If
enditall:
Application.EnableEvents = True
End Sub

Right-click on your worksheet tab and "View Code"

Copy/paste the above code into that sheet module.

Your cell reference and value may vary.  Adjust to suit.  Also change
"macroname" to your macro name.

Gord Dibben Excel MVP

On Wed, 21 Jul 2004 11:36:40 -0500, Emea training
<<Emea.training.19r5v2@excelforum-nospam.com>> wrote:

>I have a macro that I would like to run, onlly when a particular cell
>value reaches a pre-defined value.
>
>I really do not know how to do this - I have looked on help features,
>but to no avail.  any ideas?
>
>
>---
>Message posted from http://www.ExcelForum.com/

0
Gord
7/21/2004 7:05:20 PM
Use the worksheet change event that Gord suggested

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"nowfal >" <<nowfal.19rapu@excelforum-nospam.com> wrote in message
news:nowfal.19rapu@excelforum-nospam.com...
> Great answer,
> I have a little bit near question, is it possible
> to do it without having any number, if i enter into a particular  blank
> cell say 'J2',  to activate the macro or run the macro.
> thank u.
> nowfal
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
Don
7/21/2004 7:17:39 PM
Does "enter into a particular blank cell" mean you typed something into it or
just selected it?



"nowfal <" wrote:
> 
> Great answer,
> I have a little bit near question, is it possible
> to do it without having any number, if i enter into a particular  blank
> cell say 'J2',  to activate the macro or run the macro.
> thank u.
> nowfal
> 
> ---
> Message posted from http://www.ExcelForum.com/

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
7/21/2004 11:33:10 PM
I just wanted to select it, neither number nor text in that cell, an
new ideas.
thank

--
Message posted from http://www.ExcelForum.com

0
8/5/2004 8:14:30 PM
In the worksheet's module:

Private Sub Worksheet_Change(ByVal Target As Range)
    MsgBox "Changed"
End Sub

It can be confusing to see only part of a thread. This is a draw back of
using a web-based forum.
You might find it better to use the source newsgroup
(microsoft.public.excel.misc).

-- 
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"nowfal >" <<nowfal.1aj7y3@excelforum-nospam.com> wrote in message
news:nowfal.1aj7y3@excelforum-nospam.com...
> I just wanted to select it, neither number nor text in that cell, any
> new ideas.
> thanks
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
Andy
8/5/2004 9:53:37 PM
Reply:

Similar Artilces:

How to Filter cells and save the file with certain criteria?
Hello. I have a Excel file that contains a large list of Tracking Numbers. The tracking numbers are from two sets of order types- Internet orders and Mail Orders. Orders that are from the Internet are matched up with a order number such as "5678". Orders from the mail-order side are designated by initials "MO". So in Excel it'll look something like this: trackingnumber orderid 123365656666 5467 152155896345 5468 123365634567 MO 152134567789 5469 152151234563 MO Is there a way to eliminate the Mail-Order rows and save the Excel file to ...

Problem with VBA and assignment of a value
I have a form w/subform and need to display the average of one field (AverageAge) and the count of records in the subform on the form somewhere else than in the subform. I calculate AverageAge as Average([Age] in the form footer. I get the record count using the recordCount property o the subform. The problem is that I can't sem to get the value 'AverageAge' into an unbound textbox. Me.AvgAge = Me.Team_Members_subform.Form.AverageAge produces the error Application-Defined or Object-Defined error. Me.AvgAge = Me.Team_Members_subform.Form.Age gives me the correct age f...

Looking Up Values
I have a database used to record results of laboratory tests, the tests are standard but the priced paid by the customer can vary. Currently I have a standard price included as a field in the Test Table but this is difficult when prices increase across the board as I have to close down the existing test and re-input it with the new cost, also I have to have a routine whereby a form is used to manually enter any alternative prices before a routine is run to invoice the customer. I would like to create some method whereby Access would look for the current price charged to that customer i...

pasting into merged cells #2
Every time I try to copy and paste data into a merged cell I get error messages about the cells not being the same size. Even if I try to just paste values only. Is there any workaround or fix for this??? Dennis Try pasting into the formula bar. It's a pain, but it works. HTH Carole >-----Original Message----- >Every time I try to copy and paste data into a merged cell I get error >messages about the cells not being the same size. Even if I try to just >paste values only. Is there any workaround or fix for this??? > >Dennis > > >. > See my res...

Changes to the global template
Recently I had to start a new username because of some corrupted files. I was able to save my documents. However, everytime that I quit microsoft office a dialogue box appears and says: "Word cannot save changes to the global template because it was opened with read only access. Do you want to save the changes in a template with a different name?" Initially I tried to save it, because I was afraid that the changes to my document would not be saved. Now I click save, and the next dialogue box appears: "Microsoft Visual Basic" "Run-Time errror "5995" Word c...

No macro's but still macro warning
Hi, I opened an Excel '97 template containing macro's in Excel 2003 . I removed all macro's from menu Extra | Macro's and saved it. But still when opening this template a macro warning asks [Disable macro's] [Enable macro's] [Help] Apparently something about macro's is still in there. How to remove this so I can raise macro protection back to High. Any suggestions ? TIA, John7. Remove the module -- Don Guillett SalesAid Software dguillett1@austin.rr.com "John7" <NoSp@m.no> wrote in message news:ef8mo7$phj$1@news3.zwoll1.ov.home.nl... >...

Cannot insert explicit value for identity column in table x
Sql Server 2005 9.00.4035. We have a hub and spoke topology which includes 6 tables with identity columns. I need to add a new subscription to a new server (same version/sp). I took backup from another subscriber and restored to new server, ran snapshot, push subscription. To make sure a new record would replicate, I added a record at the publisher with the followig text: Insert into tblicimagefolder (imagefolder) values ('dummy') A conflict occurs with the following: This failure can be caused by a constraint violation. Cannot insert explicit value for identity c...

cell protection to allow GROUP/UNGROUP function
2 asthetic questions for all you advanced Excel Users.... Q1. is it possible to protect a worksheet, but still be able to us the +GROUP & -UN GROUP buttons ? to expand / contract the viewe ranges? Q2. anyone know how to change the colour of the AUTO FILTER button - i changes from black to dark blue when activated - i would like to hav this with more contrast and so it jumps out at you ( and the othe plebs in the office who keep forgetting) Regards David ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages dire...

Highlight Cells with different values
Hi, I have a column that I want to locate the differences. I can use the F5---Special---Column Differences. But I wanted to know if I can do it with Conditional Formatting. Like if Value in A1 is different than the values in Column A:A, then it is highlighted... Any help appreciated Fuad Sounds like an Excel question..try one of the Excel newsgroups, this one is for Publisher. "Fuad" <Fuad@discussions.microsoft.com> wrote in message news:0536FB95-362E-412F-BD1C-99BF9B10E8CD@microsoft.com... | Hi, | | I have a column that I want to locate the differences. I can use th...

Language change in outlook express
Hi, I cannot change th language to english in outlook express by defult it has French. please help me how to change in options. i check all my regional settings shows english(us) execpt in word and express. -- Nisha P nishkrish <nishkrish@discussions.microsoft.com> wrote: > I cannot change th language to english in outlook express by defult > it has French. Ask in an Outlook Express newsgroup. microsoft.public.outlookexpress.general -- Brian Tillman [MVP-Outlook] nishkrish Ask in the Outlook Express newsgroups Outlook Express with IE7 http://www.microsoft.com/co...

macros have gone missing in Outlook 2003
For some reason, my macros are no longer showing up in Outlook 2003. I have no clue as to what's going on. I still have the VbaProject.OTM file in my "Documents and Settings\Walter\Application Data\Microsoft\Outlook" folder, if that matters -- I can't figure out any way to make Outlook aware of it. Anyone got any ideas? Thanks, Walter ...

Using Emit to Return a Value
Hello: I am trying to write a piece of code that can implement an interface's methods simply by returning a specified value. I am trying to see how Mock libraries are written. For instance, I have a piece of code that looks like this: MockFactory.CreateMock<ISomething>().Setup(something => something.Foo()).Returns("abc"); What I want to be able to do is somehow implement ISomething.Foo so that it returns "abc". However, I am having a hard time figuring out the Emit code for taking an arbitrary object and incorporating it. I've never want...

running excel in background
I'd like to run a program that writes values from one cell to another with a VBA program that is triggered by the clock. I've completed this part but, since I use active cells, you can't run another workbook without the clock activating the cell in the active worksheet. It needs to run in the background all day long. - ideas? will it run in the background if I don't activate cells? Try launching another instance of Excel. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Don" <thedonallen@yahoo.com&g...

How to total cells in a range with data input
Greetings to all members I am running Excel 97. An office colleague presented me with an issue that might be of interest to any Excel whiz and seasoned programmers. I would certainly appreciate any pointers in solving it. So here goes. The set of values includes 33 cells ranging from B4:D14. The data type is numeric. Data is only input in a few cells. QUESTION What would be the function to enter in, say, cell A15 to indicate the total number of cells in range B4:D14 that have received data input? Or does it involve some behind the scene VBA programming? EXAMPLE B6 = 9 C9 = 4 D11 ...

How do I protect one single cell?
I have a spreadsheet where people are going to type in numbers, and the final cell is a total, which of course I don't want people to accidentally type over, as it will lose the formula behind it. So...... I put some "data validation" behind that cell, to say only allow entries of text length = 50 - a kind of "mock" condition. Nobody'e ever gonna type in 50 chars. are they?! And sure enough, typing in (eg) 854221 brings up the error box to stop them, just like (eg) HHJSYT brings up the error box to stop them. I even unchecked the ignore blank" box, so that ent...

change direction of cursor after enter
In excel 2003, how do I change cause the cursor to go the next cell to the right, rather than to go to the cell below? Thank you! Tools > Options > Edit > Move selection after Enter > select Right. -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings sandymann2@mailinator.com Replace @mailinator.com with @tiscali.co.uk "duke" <jbrown2lt@msn.com> wrote in message news:9793815c-97dc-4894-9adc-f3c43d71c91d@i29g2000prf.googlegroups.com... > In excel 2003, how do I change cause the cursor to go the next cell to > the right,...

macro for work book
How can I write a macro to have it refresh data and text to column/ fixed width How can I develop this macro not for a sheet but for a work book. Thanks Daniel Daniel; Hate to say so, but I don't understand anything of your question. Also, what does this have to do with "Excel charts"? -- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "Daniel" wrote: > How can I write a macro to have it refresh data and text to column/ fixed width > > How can I develop this macro not for a sheet but for a work book. > > Thanks > Daniel > ...

How-To: Last change date on row
When I set up a database I always include a last change date that auto updates every time any field in the record changes. Does anyone have a suggestion for how to achieve a similar function in a spreadsheet. i.e. put the current date/time in a field in the row whenever anything in the row changes? -- GGG ------------------------------------------------------------------------ GGG's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29220 View this thread: http://www.excelforum.com/showthread.php?threadid=489447 GGG, For example, to put the last change date in...

Subtracting time values
I am trying to calculate the difference between two cells which ar formatted with Custom [h]:mm option. It has so far worked fine unti now, the higher of the two values is over 10000:00. I now get an erro stating that the higher value is not greater than the lower value. think it is because time values are represented by a date time syste which perhaps cannot work above values of 10000:00 -- fishphon ----------------------------------------------------------------------- fishphone's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2462 View this thread: http://www...

Stop running sum(Over All) when customer change
Dear All I hv report based on tblTransaction which contains many customers with their transactions by date wise. I grouped report on CustomerID sub Group by Fromat(trnDate,”MMM-YY”) to get monthly transactions for each customer. I made calculated field to obtained closing balance with running sum over Group. I want to make the Running sum – over all but when customers is changing it must stop and start again, by default it will give running sum of all the customer, exactly this I don’t want. Any idea to stopped or make running sum based on customer when month is changing it ...

The recalcitrant active cell.
I am way over in column EO, reconnoitring data, when I need assistance of a "what if", I activate the auto filter, and the active cell jumps back to A1. any workarounds for this annoying habit? Thanks in advance. Works for me, if I filter on something in one column and the active cell is there as well it won't change to A1 2 guesses, your active cell was A1 from the start even though you filtered on EO you have a recorded macro that was setup to go back to A1 -- Regards, Peo Sjoblom "Rodney" <rodney@touch88gum.com.au> wrote in message news:u3PI%...

XML Serialisation of value/built in types
Hi, When I try to use the XMLSerializer class to serialize an object with simple types, I get node names that are the "basic" versions of the type names, ie: string testString = "hello world"; XmlSerializer ser = new XmlSerializer(testString.GetType()); StringWriter sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); ser.Serialize(xw,testString ); ....i get: <?xml version="1.0" encoding="utf-16"?><string>hello world</string> ....but what I would like is the full name of the type (ie the same as if I called string.G...

How to best imitate using Word macros in Outlook 2007
In my previous Office 2003 setup, I used Word for email editing, allowing me to use Word macros to generate common sections of text in the emails, etc. I see that in Office 2007, the email editor does not support the Word object model. How do I program a macro that would allow me to enter a certain text in the Outlook message under 2007? Thank you. What happens when you try using the Outlook Macro editor? --=20 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After furious head scratching, AMolotkov asked: | In my previous Office 2003 setup, ...

How to change labels on a chart from numbers to words?
Can Someone Please help me? I can't figure out how to change the labels on my chart in excel from numbers to words! I'm not sure which labels you want to change to words, but maybe Jon Peltier's charting tutorial will help you: http://www.peltiertech.com/Excel/ChartsHowTo/index.html Arin wrote: > Can Someone Please help me? I can't figure out how to change the labels on my > chart in excel from numbers to words! -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html I suspect it's this page: http://peltiertech.com/...

Why Propertysheet DoModal() always returns a wrong value?
Hi all, I have the following typical code. The Propertysheet has Ok and Cancel buttons at the bottom. When I click Ok button, it always returns IDCANCEL. But it actually executes all OnOk() functions. How I can make sure it returns the right value. Thanks a lot. CMyPropertySheet psDlg(IDS_MAIN_CAPTION, this); int nResponse = psDlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is ...