ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing cell colours based on a cell value (https://www.excelbanter.com/excel-programming/376003-changing-cell-colours-based-cell-value.html)

Chris Welbourne

Changing cell colours based on a cell value
 
I hope you can help as i've run into a bit of a wall on figuring this out.

I have a Spreadsheet, where "Sheet1" values are populated from a vba
recordset based on a SQL query. For each record in the record set the values
are pasted onto the worksheet. I would like the cell colours for each row to
be filled depending on the "Title" value in the second column 'B'

The appropriate title names & colours are to be defined in 'Sheet2' where
each row will contain the title name/value, and cell fill colour.

I guess im looking for some kind of vbs function to lookup the recordset
value (ie 'Mirror') in sheet 2 and apply the interior fillindex to that row,
based on the cell colour obtained from sheet 2.


Chris Welbourne

Changing cell colours based on a cell value
 
I have resolved this now. My solution was to use the Find functionality
against a range of cells for 'sheet2' offset to the next colum and retrive
the interior.colourindex for the specified cell, and apply this colorindex to
the row on 'sheet1'

"Chris Welbourne" wrote:

I hope you can help as i've run into a bit of a wall on figuring this out.

I have a Spreadsheet, where "Sheet1" values are populated from a vba
recordset based on a SQL query. For each record in the record set the values
are pasted onto the worksheet. I would like the cell colours for each row to
be filled depending on the "Title" value in the second column 'B'

The appropriate title names & colours are to be defined in 'Sheet2' where
each row will contain the title name/value, and cell fill colour.

I guess im looking for some kind of vbs function to lookup the recordset
value (ie 'Mirror') in sheet 2 and apply the interior fillindex to that row,
based on the cell colour obtained from sheet 2.



All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com