Assign Row And Interior Color Directly To Array
Feb 14, 2014
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.
View 2 Replies
ADVERTISEMENT
Dec 1, 2007
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?
View 6 Replies
View Related
Nov 27, 2009
I was viewing the Do While Loop
Sub DoWhileLoop()
Dim iCount As Long
iCount = 2 'Set to two so heading is missed
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?
View 3 Replies
View Related
Jan 8, 2009
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?
View 2 Replies
View Related
Sep 13, 2006
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
End With
Next
End Sub
View 4 Replies
View Related
Feb 17, 2014
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.
View 5 Replies
View Related
Dec 18, 2009
I have some cells that change colors based on output.
The paste and paste special functions don't always copy the correct color of the cell.
View 9 Replies
View Related
Mar 8, 2014
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.
View 5 Replies
View Related
Mar 23, 2009
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?
View 2 Replies
View Related
Dec 30, 2008
Can I have a formula which counts blue colored cells in column A.
View 3 Replies
View Related
May 4, 2012
(1) In the following macro I'd like to change the interior color to bottom borders(see last line.) How?
(2) Can I create a free standing macro that I can use with new imported spreadsheets?
Code:
Sub net5()
Dim LRow As Long
LRow = Cells(Rows.Count, 2).End(xlUp).Row
With Range("A2:I" & LRow)
[Code]...
View 9 Replies
View Related
May 10, 2012
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.
View 7 Replies
View Related
Jul 10, 2013
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?
View 3 Replies
View Related
Apr 20, 2006
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:
=If( 'Program Tracker'!E16="","",IF('Program Tracker'!E16>= DATE(2006,3,3),IF('Program Tracker'!E16<=(DATE(2006,3,9)),"YELLOW","")))
Where you see "YELLOW" is where I need to put something in so it makes the active/current cell color yellow.
View 5 Replies
View Related
Feb 15, 2010
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.)
View 4 Replies
View Related
Sep 29, 2006
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
View 7 Replies
View Related
May 30, 2014
I don't see why I cannot populate the following array The usedvar is an array of letters and I'm trying to build a new array that converts them into ascii.
Code:
Dim usedvar_asc() As Variant, f As Integer, g As Integer, temp_usedvar_asc As Integer
Dim temp_usedvar As String
For f = 1 To UBound(usedvar)
temp_usedvar = usedvar(f)
usedvar_asc = Asc(temp_usedvar)
Next
View 9 Replies
View Related
May 19, 2009
My question is about assigning an entire array to a single variable. In this case, I want to assign an entire array to one element of another array.
View 6 Replies
View Related
May 15, 2008
how to do is the assignment of GoodArray1 to CurrentArrayToUse, i.e. "CurrentArrayToUse = GoodArray1" below:
Global NextArrayToUse()
Global CurrentArrayToUse()
Global PreviousArrayToErase()
Global GoodArray1(), GoodArray2(), [etc]
Global CurrentGuessNumber As Integer
[bunch of code, part of which assigns a number to CurrentGuessNumber, then the following...]
Select Case CurrentGuessNumber
Case 1
CurrentArrayToUse = GoodArray1
NextArrayToUse = GoodArray2
Case 2
CurrentArrayToUse = GoodArray2
NextArrayToUse = GoodArray3
PreviousArrayToErase = GoodArray1
ReDim PreviousArrayToErase(0, 0)
View 9 Replies
View Related
May 15, 2013
Standard bar chart. They want our company to always be Yellow. This is a industry standard. Our columns (the bar) needs to be Yellow. As new companies are added to the series, it might change locations in the order. For now, the location is 9th.
Can use formula or use VBA. Can't seem to find a way using the Excel interface to do this.
View 3 Replies
View Related
May 15, 2014
I have an excel spreadsheet that 7 different categories (eg. Ave waittime, Avg loadtime, etc) that I have conditionally formatted based on 5 ratings (each rating a different color Green, light green, yellow, red, and purple) I would like to be able to give each cell a value based on what color it is eg. Green=5, light green=4 and so on.
View 2 Replies
View Related
Jan 25, 2009
When I insert a line to select the range on the Worksheet it does select the range named as temp. However, the array does fill but only with the first part of the range eg in this case A7:C44.
My aim is to create an array of size point1A( all the rows in the multiple ranges, 3 columns).
Example of a Range to be assigned to the Array point1A. temp = "A7:C44,D7:F44,G7:I44,K7:M44,N7:P44,Q7:S44,"
View 6 Replies
View Related
Jan 17, 2007
I have a code below. Whenever there's no file in this directory C:Summary_Reports_from_VBA , an error will surface that says "Runtime error '9'.
Subscript out of range". And once the debug option is selected, it point to this statement => ReDim Preserve s(UBound(s) - 1) .
Sub Example() ...
View 8 Replies
View Related
Oct 20, 2012
I have a worksheet (WORK1) that contains two columns of values that I can add to or change if necessary. The first column would be a text string (STRING), the second column would be its category (CATEGORY).
Example:
STRING CATEGORY
Chevron Gas
Exxon Gas
Vons Groceries
McDonalds Hamburger
In a separate workbook (WORK2), I have a column (A) which contains text. Ex:
A1 = "Station 2134 Chevron Motor"
A2 = "ExxonOil 234"
A3 = "Vons store"
A4 = "Hamburger McDonalds"
I would like to assign B1, B2, and so on... a CATEGORY if it contains STRING.
For this example, B1, B2, and so on... would be assigned the values.
B1 = "Gas"
B2 = "Gas"
B3 = "Groceries"
B4 = "Hamburger"
View 5 Replies
View Related
Feb 11, 2007
How can I assign values from a listbox to a twodimensional array?
and next
do something like search and remove a row and assign the array back to the listbox
I know I can do it directly, but I need the array for something else too
View 5 Replies
View Related
May 25, 2012
I am trying to create conditional formatting in Excel 2007 that is beyond my abilities.
I have 6 rows. The first row is a sum of all the others. Example here:
prg 1 prg 2 prg 3 prg 4 prg 5
Total
4 1 2
10 10
I would like to assign each prg its own color on the total tab, and if it spans multi programs a separate color all together.
View 1 Replies
View Related
Nov 30, 2005
If I have an assortment of odd and even values in range a1:j100, using the Array formula {=If(Mod(a1:j100,2),"",a1:j100)} will clear out all the odds, leaving the evens.
Is there a way I can add to this formula to color the qualifying cells (odds in this instance)? I know Conditional formatting is perfectly suited for the job but I am looking for a departure from this.
View 10 Replies
View Related
Dec 24, 2013
Code:
Sub TabColor()
Dim mySheets As Worksheets
Dim mySheet As Worksheet
Set mySheets = Worksheets(Array("sheet1", "sheet2"))
For Each mySheet In mySheets
With mySheet.Tab
.Color = 9
End With
Next
End sub
I'm getting a type mismatch at line 4. Can I not group the sheets like this? This is just a test program, my real one would have 10 or more tabs in the array.
View 3 Replies
View Related
Feb 17, 2012
I would like VBA code to determine the Interior.ColorIndex value of cell A1
Is there an easy way of doing that?
View 2 Replies
View Related
May 4, 2007
When you programaticly copy the contents of a cell to a string, you loose all of the interior formatting of the cell. For example, if I have a cell where only part of the text is bold... |something like this sentence here| and I try to move it around programaticly (like store it in a database) I loose the bold font in the middle.
Is there any way to extract the rich text formatting out of a range object?
View 9 Replies
View Related