How do I run a macro when a value occurs in a cell

I want to run a macro when a value appears in a cell.
How can this be accomplished?
0
Mez (2)
10/14/2004 10:21:03 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
710 Views

Similar Articles

[PageSpeed] 14

Hi!

This is a trivial example but you can build on it:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("D3") = 36 Then
Range("D3").Interior.ColorIndex = 6
Else
Range("D3").Interior.ColorIndex = 2
End If
End Sub

Put =A3*3 in D3
Try values such as 12, 10 in A3

Al

--
Alf
-----------------------------------------------------------------------
AlfD's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=478
View this thread: http://www.excelforum.com/showthread.php?threadid=26939

0
10/14/2004 11:14:57 PM
Reply:

Similar Artilces:

How to make a cell equal another cells colour?
I have conditional formatting on a set of values to highlight high/low values using a 2-colour scale. Is there a way I can get another set of cells to mirror the colour alone without changing their values? Many thanks in advance Sam.D Have them use the same conditional format rules, simply references the cells they are "mirroring". -- Best Regards, Luke M "Sam.D" <SamD@discussions.microsoft.com> wrote in message news:B6BAC7A4-17F8-4A53-BBF3-9BCED618642F@microsoft.com... >I have conditional formatting on a set of values to highlight high...

Copy macro to other row
Hi all, I've created two macron that executes calculations on a certain row. Can I copy these macros so that they can execute the same calculations but on a another row i.e. only on one row at the time leaving the others unaffected. Regards Dan As always, post your coding efforts for comments -- Don Guillett SalesAid Software dguillett1@austin.rr.com "togge" <dantorgny@spray.se> wrote in message news:1158919664.025298.246070@b28g2000cwb.googlegroups.com... > Hi all, > > I've created two macron that executes calculations on a certain row. > Can I cop...

Am I supposed to see the OUTPUT parameter's value in SQL Mgmt Stud
Hi, I have a stored procedure with an OUTPUT parameter. When I execute the procedure in SQL Server Mgmt Studio, am I supposed to see the OUTPUT parameter's value? I'm troubleshooting an issue and at this point I'm not sure if it's the application code or the stored procedure. When I execute the stored procedure, it does what it's supposed to do i.e. insert a new record, but I do not see the value of the output param -- unlike when I return values through a SELECT statement. Is this normal or am I supposed to see the value returned by the output param? -...

Excel does not return to previous cell
Hi all, I am running into an problem with my users. We have a Excel 2000 spreadsheet. I know that typically, the sheet/cell that is selected when a user closes the spreadsheet will be the same when a user opens the spreadsheet the next time. However, the problem I am seeing is that the proves true with some users, but not with all users. Some users open the spreadsheet and instead of going back to, say cell A972, it opens to, say cell B4. I would welcome any input on this issue. Thanks, Jeff Averhoff <<<"I know that typically, the sheet/cell that is selected when a user...

Password / Auto_Open Macro Problem :-(
Hi, I recently made this macro in excel: http://groups-beta.google.com/group/comp.lang.basic.visual.misc/browse_thread/thread/4224d7377faa09d3/e008d26c6bdad365 I then made an Auto_Open macro consisting of the line "call Highlighted_Text()" . My workbook has always had a password. Since opening the workbook with the Auto_Open macro, I am asked for my password as usual. But even though I am entering the correct password, I am told that it is wrong and to check if I have my SHIFT key turned off. I CAN'T ACCESS THE WORKBOOK!!!! I have tried pressing the SHIFT key different ways...

Cell Shading Color
I am running Excel 2003 in Win XP Pro SP2 I would like to set up cells so the fill color: = pale blue when the entered value is => 110 = no fill if =< 109 Is this possible? if so, how do I do it? TIA Bill Conditional formatting. Format>Conditional Formatting and set the tests accordingly. -- HTH RP (remove nothere from the email address if mailing direct) "Bill" <smile@here.net> wrote in message news:uxSFnEmHFHA.156@TK2MSFTNGP10.phx.gbl... > I am running Excel 2003 in Win XP Pro SP2 > > I would like to set up cells so the fill color: > >...

19 Digits in a Cell
It has been necessary to put 19 digits in a cell but the last four revert to Zeros (0000) I have attempted various formats of the cell but of no availe, Why? and Help please. :confused: Bri -- bri ------------------------------------------------------------------------ bri's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27704 View this thread: http://www.excelforum.com/showthread.php?threadid=489539 Preformat the cell as text (format|cells|number tab|Text) Or start your entry with an apostrophe: '1234123412341234123 bri wrote: > > It has been...

Automate Update Query Parameters using Macros
Hi I am currently trying to automate a number of databases so that they can be run 'at the push of a button'. The first of these databases contains my master tables which are raw downloads from and antiquated mainframe system. The data comes down in text file format which is then imported into Access Tables. I then run a number of update queries against the tables to convert dates and codes etc into meaningful data. Previously I have run these update queries manually but now intend to use a number of macros to be able to run them at the push of a button. I am mainly using the OpenQu...

Access 2007 Run-time Error 2467 when accessing a listbox value on a sub form
I have a database that has been in production on Access 2003 for quite some time and has run without errors. A user's machine was recently upgraded to Access 2007 and now the database throughs a Run-time Error 2467 "The Expression you entered referes to an object that is closed or does not exist" on the following line that references a listbox value on a sub form. If Nz(Me.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) = "" Then .. .. .. I changed the code to If Nz(Forms! frm_Main.sfrm_Consultant_Contract_Request.Form.Cmb_Consultant.Value) = ""...

click on cell takes you to specific sheet
Sheet 1 is a summary. Each value comes from an underlying sheet. Is there a way of clicking on the cell and it will jump me to the specific sheet. With 40 or so sheets it is hard to remember which sheet generates the value on sheet 1. Thank you You can make a hyperlink which lets you jump to a specified cell in a specified worksheet with Insert / Hyperlink.. /Place in This Document . GL, Henk "Ron Tarr" wrote: > Sheet 1 is a summary. Each value comes from an underlying sheet. > > Is there a way of clicking on the cell and it will jump me to the specific > sheet....

Protect cells from moving
I have a protected worksheet with unprotected cells for users to input data. There are formulae which read the cells to build up a set of codes. Users have been moving thier input cells (Cut & Paste) which of course corrupts the formulae. Protection allows me to prevent inserting and deletion of rows but not cells. How can I prevent users from moving cells. Its fine if they want to copy. So Copy & Paste is fine but not Cut & Paste. Thanks Neil ...

Macro Challenge!
Anyone fancy a macro challenge? I'm completely stumped! I have up to 120 values. most are unique values, but not all. I need to rank these in a particular order: lowest value at position 120 (Cell A121 with the header) 2nd lowest value at position 110 (A111) 3rd lowest at 100 etc. When all the '10's' are completed i need to go on to the '5's', so the 13th lowest value at position 115 (A116), 14th lowest at 105 etc. When the 5's are completed i need to continue the same logic with the cells filled in the following order; *1, *6, *2, *7, *3, *8, *4, *9 so that the...

Pasting into visible cells only
I have two worksheets that are set up to custom view with a sort function; i.e. it hides lines. I know how to copy visible lines to a fully open worksheet. If the worksheet I want to copy to is also sorted to have the same number of visible lines is there a way to copy just into those visible lines? I get an error box saying " cannot paste in to multiple selections". Excel will only paste into a contiguous range, so you can't copy visible cells only, and paste into visible cells only. TV Man wrote: > I have two worksheets that are set up to custom view with > a so...

Date sold filter value
OK so I give up. What's the Filter Value supposed to be when I run a Daily Sales by Register Report? It defaults to 0. It doesn't accept a date - it wants a numerical value. J hi Jennifer use the <Today> instead of 0. that's all never give up we all are here for yous to help "Jennifer" wrote: > OK so I give up. What's the Filter Value supposed to be when I run a > Daily Sales by Register Report? It defaults to 0. It doesn't accept a > date - it wants a numerical value. > J > Akber Alwani wrote: > hi Jennifer > use the <T...

Displaying a blank cell
I have this formula in my spreadsheet... =IF('Prospect Questions'!B61=""," ","") Obviously, if cell B61 on the Prospect Questions work sheet is blank, I want this new cell to appear with a blank. Otherwise I want the contents of what's in B61. When I enter this formula, it is displaying the formula. What am I doing wrong??? Is the formatting wrong??? Or just the formula?? HELP! Have you text format in the cell with the formula? Also, =IF('Prospect Questions'!B61="","",'Prospect Questions'!B61) I noticed th...

keyboard shortcut to return to previous cell after "find" or "got.
Is there any easy way to returnt to the previously selected cells? This is helpful especially after "goto" or "find". Hi, One way is to have 2 macros, both with their own shortcuts, one to store the current active cell address, and the other to use that stored address to reset the active cell. The macro would store the address somewhere on the sheet, or in a Public statement. Or a single macro could be used, which toggles between storing and restoring, depending on the state of the storage address. Would this be of help? Regards - Dave. "Nadavb" wrote: &g...

preventing a cell from being referenced?
How do you do this? I don't think you can stop it. Eijah626 wrote: > > How do you do this? -- Dave Peterson ...

can I import excel cells into word as labels
I am using Office 2000, and I'm trying to import excel data into word as labels. I have one column of numbers(approx. 350 cells) I would like to import into Word as individual labels. can this be done? -- Trial and Error takes too long! Use Mail merge. :) http://www.officearticles.com/word/mail_merge_labels_in_microsoft_word.htm ************ Anne Troy www.OfficeArticles.com "wichita6" <wichita6@discussions.microsoft.com> wrote in message news:E79D3E90-8093-4B9F-B195-DF6C4C54ED0D@microsoft.com... >I am using Office 2000, and I'm trying to import excel data into ...

Automatic removal of data labels with 0 value in a chart
Hi, I have some charts that I want to remove only the data labels which value = 0. I know how to do this manually,I am only interested in finding out how to display data labels in a chart whose values are equal to 0. If the only way to do this is by using BVA code, would you please send me some code. Is there a toggle swith in the Excel Options just like the one that currently exists not to display 0 in a work sheet? I have about 100 columns in seven different charts that I need to edit manually every week and it is very time consuming. Thanks. You can use a simple custom num...

Automatically executing macros
Is there a way for Excel to automatically execute (on loading) a macr and then close? I'm trying to get it to automatically load--print worksheet--close -- Message posted from http://www.ExcelForum.com If you recorded a macro to print what you wanted, you could rename it to auto_open. Then right before the "End Sub" add this line: ThisWorkbook.Close savechanges:=False But save your workbook before you test. When it hits that line, it closes your workbook without saving. And if you really wanted to close excel (irritating if the user has other open workbooks), add: ...

simple macro to compare lists
Hello, I am trying to create a simple macro to compare two sorted lists and move cells to be able to compare based on product number, by keeping them together by class. Each product has three rows with data that all need to be moved with it. My thought was to shift cells down if the product numbers don't match by row, since they will be sorted. However how to do this by class? The raw data looks like this: class product# totals class product# totals 1 240101 300 1 240101 302 $20000 $23000 ...

Blanking cells with formula errors
The cell with the below formula returns the #N/A sign. =VLOOKUP(A3,'!MW'!A:J,5,FALSE) The value I am looking up (A3 on this occasion) is sometimes #N/A (which I know) Is there an IF formula that I can incoroporate within the above formula to return "" if my lookup value (A3) equals #N/A. ???? I hope someone follows this! Thanks in advance! =IF(ISNUMBER(MATCH(A3,'!MW'!A:A,0)),VLOOKUP(A3,'!MW'!A:J,5,FALSE),"") -- Regards, Peo Sjoblom "Richard Layzell" <anonymous@discussions.microsoft.com> wrote in message news:099101c3a7...

Referencing an excel 'cell' value on the shapesheet screen
I have a value in an excel spreadsheet, Test.xls for example at cell 'A1', that I want to use in the PinX field of a shapesheet. How do I reference the excel sheet in the shapesheet window? I tried to use ='Path\[Test.xls]Sheet1'!A1 to do this but it didn't work. Thanks for all your help. Hi Fred, That's a cool idea and it makes perfect sense, but... I know the ShapeSheet looks like Excel, but unfortunately, you can't do this directly. You could write some automation code that might be able to do some sort of linking, but this capability isn't built ...

Macros Run In "This Workbook" vs "All Open Workbooks"
Dear Fellow Excelites, I want to set a particular workbook to run macros in "This Workbook" only. I've been trying to save it with that setting in Macro -> 'Run In:' but it doesn't seem to stick. I also want to be able to copy this workbook and have the new workbook also run macros only in "This Workbook". It keeps popping back to "All Open Workbooks" at some point. :( Can you help me? Thank you, Janet Janet, The setting you're looking at is only to specify which macros are shown in the Tools - Macro dialog. Any macro can still b...

How to: Set default value for common control in custom form
I've created a custom journal form, and added the Entry Type control. I'd like to set the default value to 'Note', but the control's properties don't allow me to change the default text value from 'Phone Call'. I've tried adding the control by dragging it from the Field Chooser as well as creating a new combobox but had no luck. Does anyone know how to do this? Thanks. Try setting it in the Item_Open event handler: Function Item_Open() If Item.Size = 0 Then Item.Type = "Note" End If End Function FYI, there is a newsgroup speci...