Run Macro Based On Cell Content
I have a drop down list made from the Forms toolbar with a list of items: 1, 2, 3, 4, 5. I have set it with a linked cell, so when you choose, say 3, from the dropdown, 3 appears in B10.
I was hoping to add a 'Go' button, which would run another macro depending on what is in B10, i.e. so if 3 was chosen, then you press 'Go', Macro3 would be run.
So I have 5 macros called Macro1 - Macro5, and I need some code for the 'Go' button which will run the right macro depending on what number is in cell B10.
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Macro For Saving Filename Based On Cell Content
Is it possible to create a macro attached to a button that allows me to save the workbook based on content of 2 cells in the workbook? I like to save the workbook based on content of cell A4 that contend a text string. After that saving another time with the contend of cell A4 plus cell A9 which contend the today() function. I am doing this because this workbook is constantly updated and a backup copy is done based on the date the file is save.
View Replies!
View Related
Run Macro Based On Cell Change
I am working on a training scheduler. In which a sheet contains the details of the trainings that are scheduled now i need that if any training is canceled then a mail needs to be sent (Status is updated in cell). I have code to send mail however the problem that i am facing is that how can i execute this macro when training is canceled. I did a search and found the following thread How to call a macro based on a value of cell? but the code given in the thread uses a specified cell address to execute the macro. Where as in my case I can not provide a specific cell address as any training can be canceled.
View Replies!
View Related
Run A Macro Based On Value Input In A Cell
I am using data validation to restrict the number of Characters a user can input in a range of cells. The number of characters in this however can vary based on which selection they selected in a different cell. To put this as an example, if the user selects "hello" in cell a1, the data validation would allow 10 letters in the cell range c1:c20. If the person selects "goodbye" in cell a1, then the validation would only allow 7 characters in cell range c1:c20. I have been using the worksheet Change function, however it updates the validation regardless of what cell is changed.
View Replies!
View Related
Run Macro Based On Time In Cell Every X Minutes
1st post. Very basic understanding of Excel / Macros / VBA but I have searched and still not quite able to get what I'm looking for. I would like to be able to manually put in a TIME in a cell, and have a macro run at set times before that TIME e.g. something like If TIME in cell A1 =(hh:mm minus 30mins) run macro 1, If TIME in cell A1 =(hh:mm minus 5mins) run macro 2 It was suggested to me to use vba code that would constantly check the time against the system time and as soon as it is 30 mins before the time in cell A1 and the 30 mins flag in cell B1 was ‘N’ then it would run macro 1 code and set the 30 mins flag to ‘Y’ to show that macro 1 had been run. and that this could also do the same for the 5 mins event
View Replies!
View Related
Run Macro Based On Corresponding Cell Values In Range
I have a range "RangeOne" and i want to check the range row by row. In each row I want to check for value in second cell. If the value is 10 or more then the entire row in the range should be selected and then execute a macro. If the value is 0 to 10(but not 10 exactly) then the row in the range should be selected and then execute macro2.
View Replies!
View Related
Add Value Based On Cell Content
I have a named range (D:16 F:800) called “NameRange” which contains names. I’d like to create a macro which offsets a letter “x”, 10 columns to the right everywhere that name appears within the range. As an example: If I’m trying to find the name Tom, A dropdown menu shows the name “Tom” ( which I’ve created) whereby it calls upon a script to search within the named range from this: Bob Kim Tom Tom Sue Mary Bill Ted Tom Sue Bob Fred Bill Sue Bob Tom Kim and offset “x” to look like this:.......
View Replies!
View Related
Deleting Rows Based On Cell Content
I wish to remove the page headers that were imported along with the raw data. Here's the code I've been using. Column_To_Check = 3 Start_Row = 1 End_Row = ActiveSheet. Cells(Start_Row, Column_To_Check).CurrentRegion.Rows.Count MsgBox End_Row Search_String = "." For Row_Counter = Start_Row To End_Row If ActiveSheet.Cells(Row_Counter, Column_To_Check).Value <> Search_String Then ActiveSheet.Rows(Row_Counter).Delete Row_Counter = Row_Counter - 1 End If Next Row_Counter End Sub When I import the data from the text file, there are 3 dimensions separated by a period in the same field. I.E: ABC.DEF.GHI and I use the break points to seperate as such: ABC|.|DEF|.|GHI|. Therefore, all rows that contain data also contain a period in cell C, but headers don't. The Problem End_Row = ActiveSheet.Cells(Start_Row, Column_To_Check).CurrentRegion.Rows.Count CurrentRegion only selects up to the first blank row. However, I need this to select the whole sheet, not just the current region.
View Replies!
View Related
Format Border Based On Cell Content
I have a dynamic table (rows regularly added or deleted) that is generated automatically based on choices made by the user in another worksheet. I need a function that will examine all the cells in one column, and when it finds a difference between two cell entries, it will change the border between these two entries to dark (medium weight), and then extend this border across the table. The end result should be that wherever the cell contents differ within a column, the table is divided by a darker border across the entire row.
View Replies!
View Related
Setting Colour Of Cell Based On Content
I have inherited a spreadsheet from someone else that rather cleverly (in my humble opinion) sets the colour dependant on the contents. ie negative value is red, zero is amber and positive is green. i like the idea and would like to use it on a spreadsheet of my own, but have tried to find out how it is done and can't!
View Replies!
View Related
Changing Cell Content Based On Button
I have created two buttons in a worksheet to navigate to two other worksheets. I would like a cell to display 'YES' automatically if one of the two buttons is clicked and or to display 'NO'. I also would like to change the colors of these cells change automatically depending on which button is pressed.
View Replies!
View Related
Conditional Formatting Based On Cell Content
I am trying to format cells based on what is in them across the board. Is there a way to conditional format based on what is in certain cells? I have 5 columns. I need to color in every NA only in the rows that have 1 or less cells with a number in there. So if there is 2 cells in that one row that have a number in them then leave the whole row white. If there is only 1 number in that row and the rest are NA then color all the NA's in red......
View Replies!
View Related
Lookup Data Based On Cell Content
I am setting up a worksheet (1) with a full list of part numbers supplied, cost etc. ie: Part Description Price Qty 1234 Blah Blah £1.00 1 1235 Blah Blah £3.00 0 1236 Blah Blah £2.00 2 And I have set up a seperate worksheet (2) as an invoice. What I have been trying to do is when I enter a qty in worksheet (1), worksheet (2) will reconise an entry in the qty colum an copy selected fields/ cells. I can do a "=" or use an "if" statement looking at anything greater than "0". but is there a way I can get the invoice worksheet to ignore any lines with "0". So it will only copy over the information with only qtys for the invoice ?.
View Replies!
View Related
Drop Down List Based On Cell Content
I'm trying to find a macro that will allow me to enable several drop down lists in the same cell based on the content of another cell. In other words: If cell A1 is the data entry cell, and the user enters "cat" Then cell B1 will display a drop down list of previously grouped options: "mouse, bug, bird" If in cell A1 the user enters "dog" Then cell B1 will display a different list of previously grouped options: "mole, rabbit, kibble"
View Replies!
View Related
Display Image Based On Cell Content
I'm trying to display a different image based on the contents of a cell. For example if cell A1 = "Gerrard" I would then like to display a picture of Steven Gerarrd. Is this possible? If so can anyone give me a steer in how I might acheive this.
View Replies!
View Related
Select Sheet Based On Cell Content
I am trying to do some thing simple, but i causes me a lot of problem in several areas. I am using the sheets( range("c5")).select to simply select the sheet that is named in cell c5 on the current sheet. can anyone give me a correct way to accomplish this that I can use in other applications that i come accross?
View Replies!
View Related
Return Number Based On Cell Content
I have a questioner in a excel spreadsheet. Column C have yes or no answers. If answer yes is implied then I want the number 2 to appear in Column F of no is implied then the number 3 will appear. I am having trouble writing the language for this.
View Replies!
View Related
Change Cell Color Based On Cell Content
I have a chart full of different names which I need to separate them by color when a specific entry is found in a Cell. For example the list has the store name "ZELLERS" + its branch number. (ex. ZELLERS #276 PL or ZELLERS #295 SL and so on). I would like to modify the below code so that It only check for the name ZELLERS and not the branch number. If it finds ZELLERS in any cell In the Range of C1:C500 then color it Red. Below Code does that but I have to write the exact name as it appears in the cell otherwise it wont find it for me. Is there any way to resolve the issue? I am not an Excel Programmer but Only an Excel user. Option Compare Text Private Sub Worksheet_Change(ByVal Target As Range) Set r = Range("C1:C500") If Intersect(Target, r) Is Nothing Then Exit Sub End If On Error GoTo Endit Application.EnableEvents = False vals = Array("ZELLERS #276 PL", "ZELLERS #295 SL", "Gopher", "Hyena", "Ibex", "Lynx") nums = Array(3, 46, 6, 3, 7, 4, 20, 10, 23, 15) For Each rr In r..........................
View Replies!
View Related
Formatting Row Of Cells Based On A Cell Content
I want to format a range of cells based on the name listed in a cell in column A (starting @A6). I currently do this manually. It is to help me visually see the line I am working with and for what person. I am almost certain that is going to take a VBA, but I know little to nothing about setting one up. I have attached a sample. I am using Excel 2003.
View Replies!
View Related
Assign Names Dynamically Based On Cell Content
I do have a data set from A1:C8 as follows:- Brand Name(A1)Sales Value(B1)Margin(C1)Levi's100002000Arrow150002500Allen Solly120001300Hanes80001000John Miller250004500Disney280003200Ray Ban180002100 The above brands are categorized as follows:- Brand NameProposed CategoryLevi'sConsignmentArrowBrandAllen SollyBrandHanesBrandJohn MillerPrivate LabelDisneyBrandRay BanConcessionaire I would like to put formula from D1:D8 in such a way so that the Proposed categories are extracted automatically through formulae. This will help in getting the contribution calculated from different categories. Brand Name(A1)Sales Value(B1)Margin(C1)Category(Desired Result)(D1)Levi's100002000ConsignmentArrow150002500BrandAllen Solly120001300BrandHanes80001000BrandJohn Miller250004500Private LabelDisney280003200BrandRay Ban180002100Concessionaire
View Replies!
View Related
External Data Query Based On Cell Content..
I have a sheet which is running a a query against an external source, and coming back with a list of client data. Each row is an investment with it's own unique InvestmentID number and a ClientID number. Each client has their own unique ClientID, however may have multiple investments (InvestmentID) linked to their ClientID (does that make any sense?!). Anyway, the query I have returns ALL investments. I know how to manually change this to only bring back certain client(s), however I want to be able to have the users (who don't know what a query is, yet alone to how to use/edit one) enter a ClientID into say, cell B2 and have the query reflect that ClientID. If they have to click a button to run a macro after entering the ClientID, so be it (although it'd be great if it actioned once they hit "Enter"). I know this is possible because I've used something similar before (that someone else created!). What I don't know is... if I had multiple "entry cells", could I have the query filter by two (or more?) ClientIDs? That is, they enter the first ClientID in B2 and the second ClientID in C2, the query then returns all information relating to B2 or C2
View Replies!
View Related
Select Range Based On Variable Cell Content
Based on if the value in col A contains the characters "TT" I want to select the range starting with this cell and ending at the end at the end of the row I'm using (.End(xlRight) and then merge these cells, change colors etc. And then looping this through a 'range' so that it only occurs where the values occur. I can amend various cells based on this idea, but am unable to identify the range and then merge the cells.
View Replies!
View Related
Remove Cell Content Based Upon Not Starting With A Word
I am working on a macro and, as part of it, I would like to look at column A of my spreadsheet and remove all cell contents where the text in the cell does not start with the word "total." For instance, if the text of a cell in column H is "total money" I would like it to remain unchanged. However, if the text of a cell is "George Baker" I would like it removed. I ONLY want the text in column H to be considered ... no other column.
View Replies!
View Related
How To Lookup Row # Based On Content Of Another Column's Cell
I have a 3 column table with 20 rows. The first two columns contain travel expense data. The cells in the third column are blank exept for whichever cell I enter an "x" in. Please let me what formula or worksheet function do I use to calculate the travel expenses based on the data in the first two columns that correspond to the row of the cell with an "x" in the third column?
View Replies!
View Related
Using Content Of Cell Within A Macro
I am attempting to use a cell reference generated using the "address" function and text function (so the cell displays text only, not formula) as a means of defining the top left cell into which I want to paste a column of formulas. The reference cell is static, but the contents is dynamic.
View Replies!
View Related
Subtract Cell From Others Based On Cell Content
I am trying to create a formula that will compute a variance between the numeric value in a given cell with the value in one of 3 other cells depending on the condition of the 1st cell. Example: If the Value in cell F4 has a condition defined as "PMR" in cell C4, subtract the value in cell F19 from F4. If the condition is defined as "DBR" in cell C4, subtract the value in F20 from F4. And if the condition is "OTH", subtarct the value in F21 from F4.
View Replies!
View Related
Adding Multiple Row Contents Based On The Content Of A Single Cell
Been trying to work this one out and have ended up banging my head against the wall. Basically I have a spreadsheet, in the first column is the person's name, in the secon which team they are in and following this a cell for each day of the month with their availability. The team name is a selection from a list, the availability is 1-6 (different levels of availability) I'm trying to do subtotals at the bottom for each separate team, so the very last row each of the cells for each is added up: Name Team 1st 2nd 3rd 4th 5th 6th 7th etc. Mr X ___1st___1______2__1 Mr Y ___2nd_______2________5__5__5 Mr Z ___1st___1____________3__3__3 Total 1st: 2 2 1 3 3 3 Total 2nd: 2 5 5 5 So basically the formula in the last row goes along the lines of: Add each cell in the column IF the team name = 1st
View Replies!
View Related
Read Cell Content & ADD Content + Font Properties *SOLVE
I use this to read cell content, add some text/characters (ie. [ and ]) and change the properties of the complete cell Sub COMMENT() Worksheets("DVD Lijssie").Activate If ActiveCell.Value 0 Then ' Change all in to ... ... ... ActiveCell.FormulaR1C1 = ActiveCell.Value & " " & "]" & " " & "[" With ActiveCell.Font .Name = "Arial Narrow" .Size = 8 .ColorIndex = 16 End With End If End Sub HOW can I change this vba-code so it leave's the content of the cell like it is and add some content with the use of let's say TexBox1 and ONLY use different font properties for the newely added content?
View Replies!
View Related
Macro To Delete Specific Cell Content
I am having some trouble writing a macro to delete cell content. I know which cells I want to clear, but I can't seem to get the macro to do it. I also want to have something in the macro that inserts data into the lines that I am trying to clear. I want cell A67 to say "Payment" and cell A71 to say "Total."This is the code I am using: Sub DeleteCell() Dim i As Integer For i = 67 To 71 If Range("A" & i).Value = "--" Then Range("A" & i).Delete Next i End Sub
View Replies!
View Related
How To Create A Macro To Edit Cell Content
I'm trying to create a macro which will edit the content of a cell and update. I'm just using the "Record New Macro" option in tools. It doesn't seem to perform the F2 edit function within the macro. I'm sure this has been discussed previously, but I can't get the search function to work for me.
View Replies!
View Related
Use Macro To Increase Cell Content 10 Points
I don't know if I am asking for something impossible,but is it possible to create a MACRO to automatically add or subtract 10 to whatever number is in the cell? for example: A1= 20 I would like to have a macro that lets you either add 10 to it to become 30 or subtract 10 to it to become 10.
View Replies!
View Related
AutoFilter Macro Using Cell Content As Criteria
I was wondering if I could pick up the Field number and the criteria from a cell in excel rather than changing the code in VBA. Range("A1:K1"). AutoFilter Field:=Range("A1"), Criteria1:=Range("B1") I was trying this code but I got an error message. Does anyone know if I can pick up these information directly from excel.
View Replies!
View Related
Run Macro Based On Value
I am trying to write a procedure that takes the value of one combo box ( a string) and based on that value compare a range of values to populate a cell with a tax bracket. So if the value is say "Single" it will then go look and see if income is between 0 and 7825 or 7825 and 31850 etc to populate a cell on the worksheet with the appropriate tax bracket. I then need to do the same if the combo box value is married, filing jointly, etc.
View Replies!
View Related
Simple Macro For Dividing Cell Content By 100 Needed
I'm only starting to get into the Macro side of excel, and I've created a couple of macros to automatically format cell contents and the like. However I'm having trouble trying to divide some cell contents by 100. I have 2 files I'm working with, one contains information regarding cd's and percentages, however the percentages in this file cannot be formatted to percentages (so the powers that be say) for whatever reason. I copy all this information into another file which does have the percentages formatted as percentages, the result is that the values get multiplied by 100. So values that read: 100 50 50.25 for example, appear on the new sheet as: 10000% 50000% 5025% Is it possible to write a macro that will divide these percentages by 100 so the read correctly as: 100% 50% 50.25% the macro will have to work on selected ranges.
View Replies!
View Related
Run Macro Based On ComboBox Selection
can i use a combo box with a dropbuttonclick to run the macro only when the arrow is selected . The problem I am having is the macro will run on the selection of the arrow which is whatt I want but it also run when I make a selection it the combo box
View Replies!
View Related
Run Macro Based On Values In Column
I am trying to write code that will run a macro based on values in a certain column. I do not know how many rows are present at the time the macro will be run. For example, if Column A has the number 2 in every row then I want macro Z to run. However, if the values are not the same then I want macro Y to run.
View Replies!
View Related
Macro To Run Serial# 1 To 10 Based On Relative Reference
I need a macro that can run a serial# 1 t0 10 (or more or less) with A1 being starting point. Here is my illustration data. Coloumn:A Coloumn:B 1 IrfanAneeza 2 Scooby Dooby Do 3 Dooby Dooby Do 4 Yaba Daba Doo However, there is a little kicker in it. The range of coloum:B varies all the time i.e. B:B could be 1 to 10, it could be 1 to 3 etc. Thus, macro should list serial#'s based on the coloumn B:B range of data.
View Replies!
View Related
Run Macro Based On Validation List Choice
I'm looking for a method, vba macro or Excel code, to preform the following task: In the C column the user chooses one of several options from a menu, let's call these options 1 - 10 (this part is already done). Depending on the choise, different things are supposed to happen: For 1-9, the formulas for cell A - Q on the current row should be copied to the next row (but with +1 in row number in formulas of course). For 10, 3 blank rows should be created (well they already are blank..), on the forth row down, A3 - Q3 should be copied exactly. On the fifth row, the same formulas thing that was created for choise 1-9 should be created. Since the real xls-file is too big already and it contains some sensitive information, I can't attach it here, but I made a small and similar xls-file, that better explain what I want to do.
View Replies!
View Related
Run Macro Based On SUM Function Result
i have the formula "= sum(A1:A10)" in cell A4 & would like to call macro when the value changes. The code i'm using below work's if I manually type in a value, but isn't working with the formula. Private Sub Worksheet_Change(ByVal Target As Range) ' Checks for cell value change If Intersect(Target, Range("A4")) Is Nothing Then Exit Sub ' If cell value change, calls msgbox based on criteria Else If Range("E4").Value = "C" And Range("A4").Value > "30" Then Call MsgBox1 End If If Range("E4").Value = "F" And Range("A4").Value > "38" Then Call MsgBox2 End If End If End Sub
View Replies!
View Related
Run Macro Procedure Based On Drop-Down Item Selected
I am trying to accomplish is to display a dropdown or combobox with a list of choices. I want the backcolor to be shaded light green to match instructional text that appears in the cell above. That I have working with the selections appearing. Once a choice is made I want a separate procedure to run that will somehow know which choice was made. I can't put the code within the module for this particular sheet as it is dynamically recreated each time the data is refreshed and the code will disappear. This may seem to be an odd practice but this is how 25+ workbooks are coded within this system for my employer's customer and it is a required practice.
View Replies!
View Related
|