Need urgent help

sku

New Member
Joined
Mar 7, 2002
Messages
1
I have an excel spreadsheet with entire rows marks with different color's. Depending upon the row color I want to populate a new column.
ie if the row color is Red then the column value should be say 'R'
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
On 2002-03-08 12:59, sku wrote:
I have an excel spreadsheet with entire rows marks with different color's. Depending upon the row color I want to populate a new column.
ie if the row color is Red then the column value should be say 'R'
This UDF (User Defined Function) will return a value that identifies the colour of a cell. You could use this to determine your data for your new column.

<pre>
Function Color_Index(CellRange As Range) As Double

Application.Volatile
Color_Index = CellRange.Interior.ColorIndex

End Function
</pre>

To use this, you first must paste it in to a module. ALT+F11 will open the Visual Basic Editor window. You then need to select the file you want to paste the code in. You can select the file in the Project Explorer window (you'll see your open files in this window. It looks similar to Windows Explorer) and select Insert|Module. This will open a new module window. Paste the code in that window. To use the formula, the syntax is:

=BookName.xls!Color_Index(A1)

where "BookName" is the name of the file you pasted the code in.
Note - this will return an error if you select more than one cell.

Regards,
 
Upvote 0

Forum statistics

Threads
1,213,568
Messages
6,114,348
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top