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
596 Views

Similar Articles

[PageSpeed] 32

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:

Wrap Text from one cell to another cell
I want type all my text into C111 (1-3 pages worth). I want this text to automatically wrap to D111 to E111 to F111 to G111, etc. The cell appears to have a maximum limit of characters. Please help. "bras" wrote: > I want type all my text into C111 (1-3 pages worth). I want this text to > automatically wrap to D111 to E111 to F111 to G111, etc. > > The cell appears to have a maximum limit of characters. Copied from the help file:- Length of cell contents (text) 32,767 characters. Only 1,024 display in a cell; all 32,767 display in the formula bar. Have y...

Retrieving Data from a Column / Row to populate a cell
I currently have data supplied to me in an Excel spreadsheet that I to transfer manually I would like this to populate a cell reference, the problem I have is that I cannot gather a train of thought to obtain the data from from a specific row/column. There is a sample of the data supplied to me below Name In Out Int Greg 165 108 29 09 July 2003 42 34 9 14 July 2003 44 19 4 16 July 2003 40 40 8 17 July 2003 39 15 8 Andrew 125 43 9 1...

Copy Cell or Column without advancing formula reference?
I have a spreadsheet with formulas referring to another worksheet. I need to copy the columns however, each time I do, the formulas advance to another cell. Which is an incorrect reference, skewing my results. You need to modify the formulas to use absolute references. Edit each of the cell addresses in the formula and put $ (dollar signs) in front of the column letters. "sgluntz" wrote: > I have a spreadsheet with formulas referring to another worksheet. I need to > copy the columns however, each time I do, the formulas advance to another > cell. Which is an...

How can I change which cell is selected next, other than Down, Le.
I know there should be a simple answer to this question, but I can't find it on the "Help" menu. Hi Bethany tools / options / edit "move selection after enter" -- Cheers JulieD check out www.hcts.net.au/tipsandtricks.htm ....well i'm working on it anyway "Bethany" <Bethany@discussions.microsoft.com> wrote in message news:50CD805D-F385-4457-9363-5C3A3EF7825D@microsoft.com... >I know there should be a simple answer to this question, but I can't find >it > on the "Help" menu. tools->options->edit and select one of...

Row heights Changed by Sorting
I have an excel spreadsheet of 279 rows: a 4-row header and 25 sets of 11 rows each. Row heights within each set have been set individually, though the pattern is common to each set. When the 275 non-header rows are sorted as a group, the row heights of most, but not all, of the final 2 rows of each set are changed. The heights of the first 9 rows of each set are not changed. The final row of each set is empty except for one cell. The cell in the selected sort column is empty. The one non-empty cell contains numeric data in another sort key column. Row 11 formatting consi...

tracking changes with insert comment
Hi Again all, second time poster here. I was wondering if anyone knows of away to programatically Insert Comment for a certain range of cells into that cell when the value changes so that the comment Will read: "Old Value was:###" Thanks again!! PS All the cells have conditional formatting (don't know if that makes a difference) Consider a non VBA method using the Tools-->Track Changes feature. It shares the workbook, but if it's on your network drive or local hard drive no one should be able to open it. You can also restrict who views it if others will have access to i...

Creating an "Empty" Cell
I have an IF statement that puts "" in cell based on a certain condition. But when I go to chart that cell (along with adjacent cells), that cell gets charted as a ZERO. I would like it to get charted as an "Empty" cell which would leave a gap in the line graph. I want the gap in the line graph indicating that there was no data for that period. I do NOT want to chart a ZERO. The question is . . . is there anyway in an IF statement to say based on a certain condition, make the cell BLANK or EMPTY (especially if the cell previously had data)? Thanks. Ch...

The data in my form is changing after the status is closed
I have a form which is based on a query for invoicing. I have some client who have been invoiced for their service and not their status is closed. If this person returns as a client and I set the new contract year and I go to the invoicing form to invoice for their new serivce the prior year contract year information for the service which has already been closed is no longer there. I want to keep this data as read only, but still be able to add new information. ...

Change the space used for my x-axis labels
Can anybody help me? I have an column chart with words as labels. My problem is that I can't change the space used for the labels, that is some labels is in two or three lines and I would like to use more room for the labels and less room for the chart itself. But when I make the chart smaller then the labels just are dragged upwards - how do I prevent that?? ...

Count Cell Range
I am having problems figuring out a Count command within a certain range. This is what I am looking for If Cells D1:D20 are less than Cell B2, Count the total cells that are less than B2 I know this is probably easy, but i just font get it Thanks again -- discgolfer_1999 ------------------------------------------------------------------------ discgolfer_1999's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27821 View this thread: http://www.excelforum.com/showthread.php?threadid=473667 Hi! Try this: =COUNTIF(D1:D20,"<"&B2) Biff "...

Assign Macro to button in Excel doesnt work Any ideas?
I have followed the instructions in help but when I get to step 3 "right click to bring up shortcut menu & enter Assign Macro" the assign macro" option does not appear!! Any Ideas Hi Mike can you see assign macro - but it is greyed out? or is it not an option at all? if it is greyed out you'll notice around the button little diagonal lines, click on these and they should go furryish .. now try right mouse clicking. if the option is not there at all, please post back letting us know how you created the button. Cheers JulieD "Mike@Becketts" <Mike@B...

how to run Powerpoint slideshow inside a dialog
Hi All, I am trying to display powerpoint slides in a dialog create by my application. if(m_pptapp.m_lpDispatch == NULL) { if(!m_pptapp.CreateDispatch("Powerpoint.Application")) { AfxMessageBox("Could not create Powerpoint object."); return; } } m_pptapp.SetVisible((long)1); Presentations presentations; SlideShowSettings slideshow; presentations = m_pptapp.GetPresentations(); m_pptpresentation = presentations.Open("R:\\Internals.ppt",(long)0, (long)-1,(long)1 ); slideshow = m_pptpresentation.GetSlideShowSettings(); slide...

Filter for Same Value in Two Fields
There are two fields in my query. "From" and "To". For sake of ease, let's say both these fields are US Cities. How can I pull all the records that show shipped "From" Denver and that show shipped "To" Denver? Thank you in advance. You stated: shipped "From" Denver and that show shipped "To" Denver Technically this would mean both values were Denver which might not make much sense if you expected the From and To to be different. Assuming you are viewing your query in design view, you would type "Denver" und...

Formula for changing Text Color??
I don't know if this is even possible. What I would like to do is t input a number into a column in sheet 1 and have a correspondin number (which is already there) change font color in sheet two. So input a number, say 3 in C10 on sheet 1 and the number 3 which is i sheet 2 (c10) changes from black to red. Is this possible? thanks very much -- dan ----------------------------------------------------------------------- danh's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1594 View this thread: http://www.excelforum.com/showthread.php?threadid=27420 You ...

formal cell
Can I format a column of zip codes listed 98221-9879 to read 98221? Howeth? Susan, =left(text, number of characters) e.g., =left(b1, 5) HTH Regards, Kevin "Susan" <anonymous@discussions.microsoft.com> wrote in message news:054d01c39daa$5c87a320$a401280a@phx.gbl... > Can I format a column of zip codes listed 98221-9879 to > read 98221? > Howeth? don't believe that formatting can do this (probably wrong <<vbg>>) anyway in an adjacent cell enter Left(a1,5) and copy down where a1 is your 98221-9879 HTH "Susan" <anonymous@discussion...

Excel Macros #4
I am running Excel 2003 and when I start one of my worksheets I get a message about the worksheet having macros. When I go to Tools Macros there are none listed. I did attempt to create a macro years ago, under Excel 97 but I could never find it or use it. How can I get rid of any macro remnent when it does not show in the list of macros. The security message is a pain in the neck when I know that there is no macro in existance Thanks of any help DJT When you record a macro, Excel creates a module in which the code is stored. When you delete the macro, the module is not automatically de...

Using a formula in a Hyperlink Cell reference
I have a workbook with approx 60 worksheets in it. I have set up hyperlinks on the 1st sheet to take me directly to the worksheet I want to see. Is there any way of using a function in the Hyperlink cell reference, so the link will automatically position me at the right cell on the target sheet? I thought I could use the COUNTA function to determine the first non-blank cell, but the hyperlink doesn't seem to like it. Hi what HYPERLINK formula are you currently using? -- Regards Frank Kabel Frankfurt, Germany "sslabbe" <sslabbe@discussions.microsoft.com> schrieb i...

error msg to run inbox repair tool
Pointing to ext of .pst file and there are no .pst files in the system. Pointers seem to be off, error is giving me the path is not correct, do I reload Outlook? I cannot determine where the system is looking for the files, nor can I find where I modify the search path. I am currently running Outlook Express w/no problem. Problem seemed to have come up when downloading upgrades. My current ISP says it is Microsoft problem, any suggestions? ...

"conditional formatting" "#values"
I have a formula that works fine but... some of the cells show #values, what i would like to do is conditional formatting them to white font if = #values. Any pointers? many thanks Try this: Select the cells to be impacted (I'll assume A1:A10, with A1 as the active cell) From the Excel main menu: <format><conditional formatting> Condition_1 Formula is: =ISERROR(A1) Click the [Formatting] button.....set the White font....Click the [OK] buttons. Does that help? *********** Regards, Ron XL2002, WinXP "Dewi..." wrote: > I have a formula that works fine bu...

emmbedding graphics to cells?
I need to pull graphics from a worksheet list to a worksheet for report. I inserted the graphics into cells and called those cells t appear in another sheet and the number 0 returned instead of th graphic. Any help would be great. Anna: -- Message posted from http://www.ExcelForum.com Those objects actually sit above the worksheet (like on another layer). You can't retrieve them using formulas. Maybe a macro??? "Anna Que <" wrote: > > I need to pull graphics from a worksheet list to a worksheet for a > report. I inserted the graphics into cells and called ...

CButton: Change size based upon text extent
I'd like to dynamically change the size of my CButton derived control based upon the text/bitmap size. So if the application calls SetWindowText during program flow the button rect will update. What's the best way to capture this and override the rect size? Thanks Eric You can use SetWindowPos to change its size. You can handle WM_SETTEXT and see what text is being set to, calculate the size of the button, change its size and then call the base class handler. --- Ajay "Ajay Kalra" <ajaykalra@yahoo.com> wrote in message news:1145984489.865667.169280@e56...

SUM for logical values
Using Excel 2002 SP3... If I type logical values into the formula, like this: =SUM(TRUE, TRUE, TRUE), my formula returns the value 3. If I reference cells containing logical values, like this =SUM(A1:A3), my formula returns 0. Does anybody know why there is a difference? -- tj Try: =A1+A2+A3 -- Regards, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "tjtjjtjt" <tjtjjtjt@discussions.microsoft.c...

merged cells and creating charts
I have tried to create a chart with data that is in merged cells where I have put in a formula to calculate the average of 4 cells in the row above. When I create the chart, it recognizes all 4 of the merged cells. So the graph has 4 spaces for the data for each number I am trying to plot. I just got 2007 version and do not recall this problem at all in 2003 version Merged cells are to be avoided at all costs. They can be used for column heading but for little else. best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Troubled...

How do I hide formulas in Excel cells?
I have a worksheet with lots of different formulas. I need to have the complete sheet show the formulas and not the results. I did this before a few years ago but don't remember how. I am working on Excel 2000. Any help would be greatly appreciated. TOOLS / OPTIONS / FORMULAS HTH, Gary Brown "Rita" wrote: > I have a worksheet with lots of different formulas. I need to have the > complete sheet show the formulas and not the results. I did this before a > few years ago but don't remember how. I am working on Excel 2000. Any help > would be gr...

Chart disappears in Excel 2000 after scale is changed
When the scale of the chart is changed, the chart disappears. The chart and its data are on the same worksheet. ...