i have loads of oval shapes on a sheet and i am trying to loop through them when i open the workbook and change the interior color to red. however i'm getting an error and i can't figure out why?
I would like to have cells that conditionally format the font color in the cell based on the background color of the cell. Essentially I have a matrix with some cells highlighted in red, yellow, or orange. There are values in each cell of the matrix. If a value is 0 I want the font to be grey. If the value is NOT 0 AND the cell backgorund color is NOT white, I would like it black and bold. Is there any way to do this in excel or using VB?
I have a column that has a date in it. If the day of the date = 07 (Ex: 08/07/2009 or 12/07/2009 etc etc) then I want to alter the font color of the ROW to be blue...or even just the text....
Do While Cells(iCount, 5).Interior.ColorIndex <> xlColorIndexNone Cells(iCount, 5).Value = Cells(iCount, 5).Interior.ColorIndex iCount = 1 + iCount 'increment by 1 each loop Loop
End Sub
I get what the loop is doing but I am not sure what the Interior is referring to. When I looked it up I saw it can be a property or an object but I am not sure exactly what it means, why you need it and in what other cases you may use it? I am so confused about this I don't even know what to ask?
If I had to guess I think it means the the property of the individual cells but in that case I don't see where the object comes in?
I am using Office 2007 and have successfully used the Cells.Interior.Color to change cells fill color. I would like to be able to undo these changes. Depending on the data entered I am changing the color but I may need to change it back to white. When I use the Cells.Interior.Color = vbWhite the cell fill changes to white but the cell border is gone. Is there a way undo the color change and have the cell border show up?
I have some code that recently I found I had a new criteria that I originally did not have when I worked my original database. THis code works perfectly as is BUT if in column "D" if this is blank I would like to do nothing/ make no changes in that row.
Sub ChangeColorsotherdesigXXX() Dim c As Range
For Each c In Range("D2", Range("D65536").End(xlUp))
With Range("a" & c.Row & ":s" & c.Row) If Not CStr(c.Value) Like "612#" And Not CStr(c.Value) Like "712#" Then .Interior.ColorIndex = 36 .Font.ColorIndex = 1 End If
In Sheet1 cells A1-BW46 (3450 cells), using 9 different colors to fill all the cells.
In Sheet3, starting in A2, I have a plain text list of 3450 cell ranges "A1", "A2", "A3" etc covering all 3450 cells in Sheet1.
I want to populate next to this list the interior color value of the corresponding cell. So in cell A2, I will have the text "A1", in cell B2 I would have either a numerical or text value giving me the color that A1 in sheet1 is filled with.
The script doesn't have to auto update, I will run manually when neededI don't need any manipulation, only the value of the color, and that can be hex, rgb.
I can't upload the actual sheet I'm working with, but if my description of the problem is lacking, I may be able to create a sample sheet to give the idea.
I have a B2:M13 range. I would like to find a way to find the next cell with Interior.ColorIndex = 1.
For example, if position is currently B2 (so myrange(1, 1)) and the next black colored cell is on B6 (so myrange(5, 1)), I would like store 5 and 1 into variables.
So if no black background is found after current cell on the same row, look for next black background on next row.
If current cell is in row-M (the last one ** the range), for example, and there's no black background following on this row, find first black background in row-B.
I have 2 different worksheets...each of them containing item numbers. On Sheet1, Column A contains the item numbers. I have conditional formatting to change the interior color of column A based on several criteria.
On Sheet2, I also have item numbers, but they are located in Column B. If item 12345 in Column A on Sheet1 has an interior color of yellow, I would like that same item on Sheet2 to have an interior color of yellow.
I have a userform which stores the backcolour value of some labels in a spreadsheet so that it can be recalled dependent on what month a user selects. The trouble is that in a spreadsheet, I want to use these backcolor values to colour the interior of a cell. However, the values don't seem to be liked by VBA and I get a 'subscript out of range' when I try to match:
Range("SPPCScore").Interior.ColorIndex =
This error comes up against values 65535 and -2147483633
What am I doing wrong? what would be the best way to store a backcolor value in one cell so that it can be used for a cell interior colour?
I need to have 3 arrays for a column of data, the first holding each cell value, the second the Row number and the third, the Interior.Color.
Currently I am having to assign each row and interior colour to a variable with a | between each then use the split function on that variable to assign it to an array (no problem with each cell value as that can be assigned directly to an array.
Code: For Each rC In Range("a2", Range("a" & Rows.Count).End(xlUp)).SpecialCells(12) If sO = Empty Then sO = rC.Interior.Color Else: sO = sO & "|" & rC.Interior.Color End If If sR = Empty Then sR = rC.Row Else: sR = sR & "|" & rC.Row End If Next c = Split(sR, "|") v = Split(sO, "|") x = Range("a2", Range("a" & Rows.Count).End(xlUp)).SpecialCells(12).Value
As there are over 10,000 rows involved loading the variables is taking a considerable amount ot time, whereas the direct loading of the value is very fast. So I want to be able to load all arrays directly.
I have tried various methods to get Row and Interior.Color to load directly into arrays c and v but without success so far.
I am not looking into a VBA solution for this one and want to keep it simple. I want to enter a basic IF function/formula to make the color of a cell yellow if the condition is true.
Here is where I am stuck/what I am putting inside the cell:
I'm trying to make a simple chart with VBA based on a row with values that will color the offset cell interior red and also give it a value of 1. (look a the example sheet.)
I have an error message that says: Run time error '1004': Unable to set the colorIndex property of the interior class. I attached code for your reference.
If (Range("B10").Value = "Gift" Or Range("B10").Value = "Entertainment") And Range("C10").Value = "" Then Range("C10").Interior.ColorIndex = 6 MsgBox "Please Fill in the Person's Name & Company." Range("C10").Select Range("C10").Interior.ColorIndex = 6 End If
Im trying to create shapes Rectangles and Squares with different colours within an excel sheet, where the length and height of the shapes is generated by input values.
Also is it possible to create 3D shapes, again where the size of the shap is generated by input cell values.
I have a bit of VBA code that loops through a range and looks at the color index. If it is color index three then it will put a "1" in the cell six columns over. This code works, but I see over and over again that loops are bad and inefficient. Since I am working on my code being more efficient I wanted suggestions for altrenate code that would do basically the same thing.
Dim Bcell As Range For Each Bcell In Range("D2:D304") If Bcell.Interior.ColorIndex = 3 Then Bcell.Offset(0, 6) = "1" Else Bcell.Offset(0, 6).ClearContents End If Next Bcell
Starting at cell H4 and down, I have data pasted to whatever last row, this is a helper sheet/vba thing that helps to create the Case Statement for SQL queries, we have many of them, broken into Pages. So this works great, grabs the data and puts 'data','data2'
The only thing is that in the last data cell in the loop, it leaves off an extra comma, as in:
'306','307','308','309','310','311','312',
I need help in removing that extra comma if there is nothing left to process in the loop so it would look like this:
'306','307','308','309','310','311','312'
Sub Test_Range_Loop()
Dim x As Variant Dim rng As Range, cel As Range Dim lr As Long
lr = ActiveSheet.Range("H" & ActiveSheet.Rows.Count).End(xlUp).Row ' find the last row from the bottom-up using H
With ActiveSheet Set rng = .Range("H4:H" & lr) For Each cel In rng x = x & "'" & cel.Value & "'," Next .Range("I1").Value = x End With End Sub
I have a userform called "DBQuery" and textbox in that called "Query".
What i need is a piece of code that will search the text in the box (after update of course) and Capitalise certain words (SQL ones like "SELECT, FROM, WHERE, AND, IN, LIKE, IS, NOT") and chenge the font colour blue?
I'm currently trying to create a rota timesheet which automatically takes shift patterns and deducts for unpaid breaks.
Basically if a shift is less than 4.5 hours long then no break is deducted If the shift length is 4.5 - 6.5 hours then 15 mins are deducted If the shift is longer than 6.5 hours then 30 mins are deducted.
The Macro Sub Match() works great, it is blazing fast.
It matches Col B on Sheet(1) to col B on Sheet(2) and returns the match from sheet(1) to sheet(2) by inserting a col D in sheet(2) and returning the match found to the row at which it was found in col B.
But I need to return not just the matching name from col B but the cells on the same matching row from col C, D, E, F, G, H ,I from sheet(1)
I do not understand to code well enough to do this
I've a file that uses user respone to navigate through a number of charts like a slide show (not my work - downloaded from PHD I think). To move from one 'slide' to the next users are required to select "Ok" on a OK/Cancel Msgbox. By default the MsgBox pops up in the middle of the screen. I'd like to control the position of the MsgBox programmatically.
I need to changing the time data in my Time of Turn. I would like to subtract one hour from every data entry in the column Time of Turn, ie from 9:35 to 8:35, 9:55 to 8:55, etc. How would this be done with a macro for the entire workbook?
I have a workbook with several tabs. One tab is named for the year eg 2014. Annually, I open the workbook, rename to the new year and rename the year tab to the next year eg 2014 to 2015. All the dynamic range names update as expected. Sheet2(2014) becomes Sheet2(2015). However, a line of macro code does not change and errors out because the year does not change.
Is there a way to dynamically modify the '2014' sheet reference to reflect the renaming of the year tab eg to 2015 or to reference a helper cell named YEAR?
The cell referenced above R332C1 is dynamic.
I have tried writing the above line many ways based on internet research but no success. I suspect I can use a LEN function to actually modify the line of code but I'm not sure its even possible to alter a macro dynamically to meet my needs here.
Is there a function or macro that can take a list of about 200 numbers and search for these numbers throughout the workbook, If 1 of these numbers exists anywhere in the workbook, it changes the color of the number or does something to the number where I will know this number is part of the exception list? The list of 200 numbers in non changing, however the numbers I want searched will change daily. There will also be worksheets added and taken away that contains these numbers.