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

Similar Articles

[PageSpeed] 41

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:

Need invisible/shaded/highlighted cell
I'm thinking what I would like to do can *probably* be done in VBA, but I'd like to use the formula in the cell. If it can be done. I have three columns: DOW DATE BILL DTE --- -------- -------- Wed 02/01/06 02/03/06 Thu 02/02/06 02/06/06 Fri 02/03/06 02/07/06 Sat 02/04/06 02/06/06 Sun 02/05/06 02/07/06 Mon 02/06/06 02/08/06 Tue 02/07/06 02/09/06 Wed 02/08/06 02/10/06 . . . . The date col contains a formula to add 1 to the cell above. The day of week col uses the date from the date column. And the bill date col adds 4 days to the date col if it falls on a "Thu...

Transparent bitmap in FlexGrid cell?
I have a bitmap in the resource (IDB_PICTURE). I need to display it on a FlexGrid's cell with transparent background. Could someone show me how? This is the only function available to put a picture on a cell CFlexGrid::putref_CellPicture(LPDISPATCH) Thank you. ...

linking cells #3
I have a calendar created in Excel - each sheet is a new month that contains the following information: the last week of the previous month, the current month, and the first week of the next month. I would like to link the cells from the "overlapping" weeks, but I do not want the "0" to show up in the cells. Is there any way to prevent this? Thanks in advance! Paula Either choose not to show zero values through Tools>Options>View or trap the zero and turn to a blank-looking character. =IF(sheet1!A1="","",sheet1!A1) Gord Dibben Excel M...

Getting value from 2 cols right, 1 row down
Hi, I guess this is a simple question but I couldn't figure out how to ge around it. Code ------------------- A B C D E F 1 Worker 100 100 100 100 2 110 110 3 Worker 120 120 120 4 130 130 13 ------------------- Sheet above is a work schedule and 100, 110, 120 and 130 are jus predefined work shifts. Row 1 is a morning shift row and Row 2 is night shift row for the first worker. Now what I want to do is to create another sheet with workers names t m...

a little help with finding and associating cells
ok so here is my dilemma, I need a formula that will look at a cell value on one work sheet, check for the same value on another work sheet in a defined column, and insert a coresponding value from another column...... is that even remotely possible??? any help would be greatly appreciated.... -- rcarrollct ------------------------------------------------------------------------ rcarrollct's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24931 View this thread: http://www.excelforum.com/showthread.php?threadid=384671 It's called VLOOKUP. http://www.offi...

"Diagonal" cells
Hi. I'm doing a tricky poor-man's-Illustrator project with Excel 2007. I'm trying to create the impression of a large cell that's been split in half diagonally (with a diagonal ascending from bottom left to top right). I've created a 2 x 2 grid of cells and put a diagonal border through the lower left and top right cells and removed the vertical, internal borders. Looks great so far. In addition, I'd like to place text in the upper left and lower right cells. Ideally, this text would be wider than the upper left or lower right cell and would flow over into the adja...

insert symbols in text cell
i would to insert "-" to the text cell format, how to do? example: 123456 change to 123-456 -- SelinaT ------------------------------------------------------------------------ SelinaT's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=33675 View this thread: http://www.excelforum.com/showthread.php?threadid=534451 Assuming the data posted is representative (6 digits, with dash to be inserted in centre) and running in A1 down Try in B1: =LEFT(A1,3)&"-"&RIGHT(A1,3) Copy down Then copy col B, and overwrite col A with Paste special &g...

Printing Formatted Cells
I have conditional format on a cell to format with say Fill Red ... It displays OK on the screen but doesn't appear when printed? I'm sure it'll be something obvious! Is your print setting for color, or B&W? Long shot, but I'm not sure of any other reason why what-you-see is not what-you-get. -- Best Regards, Luke M "Charlie" <Charlie@discussions.microsoft.com> wrote in message news:C94E101A-9579-4FDB-8AEF-91D59E1EC3A4@microsoft.com... >I have conditional format on a cell to format with say Fill Red ... It > displays OK on the sc...

Hyperlink Macro / Hide Tabs
Hi I have an Excel 2007 worksheet with 10 tabs. The first tab has a contents section where each of the subsequent tabs is hyperlinked. By clicking on the hyperlink I go to cell A1 of whichever tab I select. In addition each tab has a hyperlink taking me to the contents tab. I would like a macro where, when I click on a hyperlink, all tabs other than the cover tab and the selected tab are hidden. In addition when I click on the contents tab in a selected tab every tab is hidden bar the contents tab. Can anybody help? Rup ...

minimum cell value
Hi, I am trying to set up a cell so it has a minimum value. The current formula is: =a1/a2*5 which gives the answer 0 but i need to show a minimum value of 1 is this possible? Hi, Doug, Try: =Max(a1/a2*5,1) --- Regards, Norman "Doug Bell" <Doug Bell@discussions.microsoft.com> wrote in message news:8766BC4D-D3CD-4B4F-AF7B-FD145DE56205@microsoft.com... > Hi, > > I am trying to set up a cell so it has a minimum value. > > The current formula is: =a1/a2*5 which gives the answer 0 but i need to > show > a minimum value of 1 is this possible? > ...

I can not see all contents in one cell. Help me pls!
Please help me! By default when I write some text in cell and the text is longer then cell's width, I can not see his contents in next cells. But in one excel file when I sellect all cells in worksheet and then draging them it can no longer seen all contents in one cell. What I should to do? Thank you in advance! If you have wraptext turned on (format|cells|alignment tab), then the cell will expand its rowheight to show you all the data. (unless you use merged cells or have adjusted the rowheight manually). If you have wraptext turned off, then the text will overflow to the cell to ...

format to calculation cell
I have a spreadsheet which has a weight column. This is exported as 25kg, 1000kg, 10x2kg from another program. I am trying to use this weight column in a calculation. I have inserted a new column and copied the information over and then used the find/replace to remove the KG to use in the calc cell. This works fine for the 25 / 1000 etc, but the 10x2 will not caculate. Is there a way that when i paste the cells that i can get it to change to 20 automatically. ( i presume that the x will need to be a * ?) thanks. -- mdma --------------------------------------------------------------...

Filter List for Linked Values
I have a list of Numbers. In that list some Cells are: - Linked Values [ e.g. ='[Sales.xls]Sheet1'!K61) ] - Forumlas [ e.g. =1802+254+356 or =sum(A2:B32) ] - Manually Entered I want to filter the list for linked values. Is this possible? Hi not without VBA (using a user defined function) and a helper column >-----Original Message----- >I have a list of Numbers. In that list some Cells are: > > - Linked Values [ e.g. ='[Sales.xls]Sheet1'!K61) ] > - Forumlas [ e.g. =1802+254+356 or =sum(A2:B32) ] > - Manually Entered > > I want to filter the l...

import hyperterminal value into excel
How do I import a hyperterminal value into an excel cell? ...

Line chart, value labeling
I like to change line graph settings so that only one value will appea on the line (not all the values). I right clicked on the point on the line, selected format data series selected Data Labels tab, checked box Show Values. and then click ok. All the data values show up on the line. But, I like to see only on specific value. How do we do that -- Message posted from http://www.ExcelForum.com Hi, You need to select the line series and then select a single point before displaying the format dialog and enabling data labels. Cheers Andy NYBoy < wrote: > I like to change line graph s...

Formatting cell for state abbreviations
I am unable to format cell to accept ME, the abbreviation for Maine. It continues to revert to a lowercase "E" as in "Me" while other states such as NH, VA and LA maintain their uppercase second letter. What am I doing wrong? Thank you -- LovesArt247 This is a AutoCorrect item for people who mistype the word "Me" (as in me myself) Tools | Autocorrect; locate and remove this entry -- remember it will effect all Office apps OR: after Excel gives you Me, use CTRL+Z to undo best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme rem...

Excel 2003, when I click on a particular cell it gets deselected
While using Excel 2003, when I click on a particular cell, within 30 seconds, that particular cell gets deselected followed by the workbook. So each time I need to click either the cell or workbook to enter data in that particular sheet. There could be event code that is being fired. Does this happen if you open the workbook with macros disabled? HTH, Bernie MS Excel MVP "towinwin" <towinwin@discussions.microsoft.com> wrote in message news:B7B87AFB-27AC-4235-9AE3-5E7A46310AF8@microsoft.com... > While using Excel 2003, when I click on a particular cell, within 30 se...

Macro Run on WorkBook Open?
Have a macro that I want to run when the file is first opened. Is this possible? If so, How? Thanks in advance -- / Sean the Mc / "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) You answered your own question. Right click on the excel icon just to the left of FILE> the workbook_open event is there. -- Don Guillett SalesAid Software donaldb@281.com "What-a-Tool" <Die!FrigginSpammersDieDie!@IHateSpam.Net> wrote in message news:MetMc.7592$BX.2445@lakeread08... > Have a macro that I want to run w...

how do I highlite text within a cell (specific characters)
I am trying to high light specific characters within a cell. (similiar to the way text can be high lighted in word. Can this be done in Excell. I dont want to change the colour of the cell or the colour of the text - but do want to high light specific parts of the text with in a cell Just select that part of the text and format as per your requirement by going to cells > format > font. Mangesh "tim" <tim@discussions.microsoft.com> wrote in message news:A9781298-1301-4FE1-9901-9D1C03504504@microsoft.com... > I am trying to high light specific characters within a ...

creating a macro that will paste a value and then move
Please, help! I am trying to recreate a macro that opens a workbook, goes to Sheet 1, pastes clipboard info into A1, then moves to B1, then saves and closes the file. I know how to make the file automatic and how to get it to open and close (Auto_Open), but I cannot remember how to get the macro to move from cell to cell (left-to right). What happens is that when I do a recorded macro and then try to rerun it; it will paste into A1 and then will tab over to B1. Then upon the next time that I call up the spreadsheet, it will even paste to B1, but will not move further from that spot. I then...

Weird problem -- formulas get lost but their values stay in place
I have a client who uses Excel files that link out to other excel files. The formulas in the "main" file calculate from data in the linked files. So, the formula is in the main file. When they close the main file and re-open it, the formulas are gone, but the last calculated value remains. Does anyone have an idea why this would happen? Thanks, Bill One way might be because a "Before Save" or "Before Close" Macro is doing a Copy > Paste special > Values........ Vaya con Dios, Chuck, CABGx3 "Bill" <bdotson@gmail.com> wrote in message...

Cell colors
In Format Cells (Excel 2008), there are 40 colors in the top five rows and 16 more colors in the bottom two rows. I see how to change the colors in the top rows (Preferences > Colors), but how do you change the ones in the bottom rows? Charles ...

how to copy a row of cells automatically from one worksheet to another by changing the value of1cell
Hello. I have 8 cells on the same row in one worksheet that I would like to be automatically copied to a predefined area in one of 3 other worksheets in my file depending on the number (1, 2 or 3) entered in one cell adjacent to these 8 cells. Is this possible and, if so, how could it be done? Thanks very much for any help you can offer me with this. ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Software! http://www.ozgrid.com/Services/excel-software-categories.htm ** David, You could use the worksheet change event: this will copy the eight cells from the s...

RE: Xcel2000 cell highlighting
Hi We have a client that is using Office 2000. He has a very odd problem with Excel that we simply cant get sorted out. I thought itwas some sort of virus, but the software after being updated, detects nothing... Please help! When the client clicks on one cell and starts highlighting his fields, his mouse continues highlighting even after the mouse button is not clicked anymore. He can't exit Excel until he Ctrl,Alt-Delete. Any Tips on what the cause could be? Many Thanks Jacques Brand IT Manager CompuMan (Cape Town) South Africa Jacques, If it highlights from a constant "bas...

Splitting information from one cell into two cells
I have a multi page workbook. On Sheet 1 I have a cell that contains a person's full name (first and last name). I would like to automatically transfer the name to other sheets in the workbook but I would like the first and last names to be placed into separate cells in Sheets 2, 3, 4, etc. How do I do this? Thanks!! Hi, Use Menu--Data--Text to Columns... jeff >-----Original Message----- >I have a multi page workbook. On Sheet 1 I have a cell >that contains a person's full name (first and last >name). I would like to automatically transfer the name >to o...