I'm playing with an excel file that has 3 different spreadsheets and basically the same layout just different product lines on each sheet. I need to find a snipet of VB code to change cell color depending on if another cell is used(filled in) or if it is blank. I'm very limited to my VB skills but can tinker enough to get what I need if someone points me in the right direction.
here is an example of what I'm trying to accomplish using the following Columns:
I would like to be able to change the color of a cell in V4:AB31 and have the formula in AM10:AM13 automatically calculate the new result. As it is now the user has to press Ctrl ALT f9 for the formula to recalculate.
I have two columns. The first one (A) contains cells that have different Fill colors. The second column (B) contains text adjacent to the colored cells. I am trying to change the color of the text in the second column (B) to the corresponding color in the adjacent cell in the first column (A). I don't think conditional formating works well in this situation. I believe the solution would be some sort of macro.
I have font color white in blank cells in column E and I (from row 5 to row 245) so the visitors will not see the text. If any of these cells become yellow (color code is 6), the font color will become black so visitors can see the text alot far better than white. I've tried this code myself after this post but nothing happen
I have various row cells in column (F) filled with the color Green. And corresponding text in Column G. How can I change the text of that particular row to white.
i.e.: if any cell in column F is Green, change the text color of that row in Column G to white?
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim VRange As Range Set VRange = Range("Obj1") If Not Intersect(Target, VRange) Is Nothing Then Range("ObjDescr1").Select ActiveCell.FormulaR1C1 = "=IF(Obj1="""","""",(IF(EmplType=""Salary"",VLOOKUP(Obj1,SalaryDevGoalsTbl,2,FALSE),VLOOKUP(Obj1,HourlyDevGoalsTbl,2,FALSE))))" Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False End If End Sub
What it does, everytime range named Obj1 is selected, range named ObjDescr1 is populated to a Vlookup, depending on which type of employee.
I need the Worksheet Change procedure to handle Obj2 - 5. I want to Change Procedure to find out which named range Obj(n) is effected, and to do the rest on that one. ObjDescr(n) is also to match the value of (n).
How can I do this the most efficient way? I want to cut down on code in ever area possible, so I dont want to just copy and paste for obj1,2,3,4 and 5.
I'm trying to create an array formula that returns all the cities in a given state by imputing the state's abb in cell K2. The returned cities go into column J. California has the most cities(430) and the cities are 5000 rows deep.
I am looking to find a way and synthesize code that will prompt the user for text data when he/she clicks a radio button, then place that text data in a "Notes" worksheet within the same workbook. Given that there are multiple radio buttons, with options of "OK" and "attention needed" (it is a checklist of maintenance items), I also need to find a way to have each note listed sequentially in the notes worksheet. My questions: Is this possible using macros? Can you steer me in the right direction? (change event, inputbox, then what?)
Private Sub ComboBox1_Change() ComboBox1.List = Array(100, 200, 300, 400) If Range("I11").Value < Range("N11").Value Then If Sheets("Profile").Range("K18").Value < ComboBox1.Value Then Range("I11").Interior.ColorIndex = 2 Else Range("I11").Interior.ColorIndex = 3 End If End If
End Sub
I want it to change the cell color on drop down change. How can I modify things to have the change in drop down selection?
I am having some color problems. From A2:AB2000 I have different fill colors for cells all over the place. The only color I need is the color purple which I believe is the color “39”.
So basically all cells except the cells with the color purple change to white from A2:AB2000. I would like to add this code to the macro I have already created.
I'm trying to put together a script which changes the color of the row in columns A:AE if any cell in the Range B7:B400 has the value of 'No'. If it has the value of 'Yes' I would like it to Exit Sub.
I've put together the code below to try an create this function, but I'm running into a few problems.
Code: If Intersect(Target, Range("B7:B400")) Is Nothing Then Exit Sub If Selection.Cells.Count > 1 Then Exit Sub If Target "No" Then[code]....
When the value of any cell in Range B7:B400 is 'Yes' the row changes to grey, if I enter 'No' it removes all cell shading from the row, and I'm not very clear on what changes I need to make.
I've got some spread sheets that I send out. People fill them out and send them back to me. The only problem is that I dont know which cells they've changed and which cells they've left. Is thier a way to tell VB to change the color of a cell if the value has changed
I have to check a cell to see if ti has a date in it, if so , then i have to check the current date to another cell, if the current date is greater then that cell i want to change the color of the cell
When I click on a button I would like an option to cancel a row range of cells by turning the writing red with a cross through it.
So if I wanted to cancel a certain row of data I would click on a button, enter the range of cells to cancel and then this would turn all of the writing in the cells to red colour with a strike through the words.
i need to add this in a macro that i previously created here is what i need, i hope its clear for everyone to understand
I want to be able to change a color of a row to purple if a cell is greater than 5 days so basically what i need is something like this
IF BQ1 has the data "APPROVED" and data in BP1 is 01/04/10 and BN1 is blank and if BN1 is blank after 5 days of BP1 then the color of this row changes to purple
I'm putting the sum of 3 cells in a 4th cell(D2). If the sum is greater, I would like the sum to be the color green. If the sum is less, I would like the sum to be the color red. Is this possible?
(D2) has change value, I want to compare the new value against the existing one.
I would like to change the default color of any excel sheet I use to grey from the standard white and I am struggling to find out how this is achieved.
In other words, I am trying to have all cells in the sheets I work with appear grey on my screen by default. A coworker of mine used to work in banking and she has grey cells but does not know how she changed them.
I'm trying to do. I have 2 columns, both have empty cells with borders. I would like to make it so that when the user clicks one of the cells, it turns grey and the one beside it turns white. I set up two macros as follows:
I'm trying to set up a spreadsheet to track 20 vehicles mileage, and when they are due for an oil change. I have the value of when they are next due in column D, and the actual mileage in column G. I want to have the row for each vehicle turn yellow when they are within 1,000 miles of needing an oil change, and red when they are due/overdue.
I ran a quick code to see if this would work. it did at first then stopped.
Code: Private Sub Worksheet_SelectionChange(ByVal target As Range) tcol = target.Column trow = target.Row If Cells(trow, tcol).Interior.ColorIndex = -4142 Then Cells(trow, tcol).Interior.ColorIndex = 8 If Cells(trow, tcol).Interior.ColorIndex = 8 Then Cells(trow, tcol).Interior.ColorIndex = -4142 MsgBox trow & " " & tcol & " " & Cells(trow, tcol).Interior.ColorIndex End Sub
In short I am trying to toggle between color/no color when a cell is selected. I got the -4142 from using the MsgBox to determine the value. Should I be approaching this differently?
I have been trying to figure out how to change the color of a specific tab based on information being entered in cell "B9" for each sheet that the tabs represent. If there is information in cell B9 on "tab 1", I want only tab 1 to change a color. If there is no information entered in cell B9 of tab 2, then I want tab 2 to stay with its default color.
There are 34 tabs I want this to happen to, out of just more than 60 total tabs on the worksheet.
I am working on a code in which i have to change the color of certain cells if the value of a cell is Y/N. The color should change with the user input.
Set wsheet = wbook.Worksheets("XYZ") For Row_start=10 to Row_count 'Row count is the last used row in the worksheet RowValue = ActiveCell.Row colValue = ActiveCell.Column if colValue = 17
I want to be able to enter the name from the above 4 cells (B3,B4,B5,B6) IN THAT COLUMN, and have the active cell change color accordingly.
If I am in cell C7 and start to type "PUBLIX" It should turn red in color. It does not because the code looks to a specific cell (example: B3). What can I change in my code to give the results I desire?
I have conditional formatting code below I copied from THIS site:
Private Sub Worksheet_Change(ByVal Target As Range) ' Multiple Conditional Format Dim rng As Range ' Only look at single cell changes If Target.Count > 1 Then Exit Sub ' Adjust Format range to suit Set rng = Range("B7:H74") ' Only look at that range If Intersect(Target, rng) Is Nothing Then Exit Sub ' Adjust conditions to suit Select Case Target.Value Case Range("B6").Value Target.Font.ColorIndex = 50 ' Green Case Range("B5").Value Target.Font.ColorIndex = 3 ' Blue ' Case "Super" ' Target.Font.ColorIndex = 6 ' Yellow Case Range("B4").Value Target.Font.ColorIndex = 13 ' Purple-ish Case Range("B3").Value Target.Font.ColorIndex = 5 ' Red ' Case "Corporate" ' Target.Font.ColorIndex = 37 ' Light Blue End Select End Sub
I would like to have a vba code that changes the cell color so that if there is number 1 (just number 1) in some cell the background of the cell changes in to shade of grey and cell that has number 2 changes into darker shade of grey and so on. I have numbers 1-10 in random order in my sheet. I mean there is many cells that has the same number and the sheet is quite large so vba code would be ideal choise to do it quickly.
Cells C7:F7 are currently shaded light green. Cells G7:L7 are shaded light blue. M7 is shaded dark blue. N7:Q7 are shaded light yellow and R7:T7 are shaded light gray.
When any cell in that range (C7:T7) is clicked (selected), I want the cell color to change to it's normal color; like light yellow to yellow, light blue to blue, dark blue to blue, light green to green and finally light gray to gray.
These cells represent headings for a database. When a heading is selected, the database will sort by that column and the header will change colors. I can do the sort code.
If another header is chosen, the previous selection will need to revert back to it's lighter color and the new selection will change as above... so only ONE cell will be changed from it's "normal state" color at a time. This will serve as an indicator as to which column is being used for the sort. To the user, it will have the appearance of switching on and off.
If any other cell on the sheet is selected, then this should not trigger an event change.