Resistor color code-ing in worksheet

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
169
Hi all. I want to creat a sheet that will hel pe print some labes for my resistor (electronic componants) cabinet.

resistors are marked with colors to determin the value of the resistior

ie
black = 0
brown = 1
Red = 2

...and it goes on

I want to insert lets say "1" into cell A1 and via R1C1 method, cell A2 to change to brown...

put a "2" into cell B1 and similar again B2 turns red. All the colors are pretty well handeld by excel so if I can get a handle on the first three colors and formuli, I should be able to continue from there....

R1C1 has to be use because im pasting these values down the page to print my labels.


Thanks for any help
Mark
 

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.
Hi there

This might give you some ideas:

Create a table of colors. (Here I have used G1:G3). Color each cell and type in its number (eg G1 = 0 and is black, G2 = 1 and is brown etc)

Alt+F11 to go to the VB Editor and paste this code in the large code window:

Private Sub Worksheet_Change(ByVal Target As Range)
For Each cell In Range("G1:G3")
If cell.Value = Target.Value Then
Target.Offset(1, 0).Interior.ColorIndex = cell.Interior.ColorIndex
Exit Sub
End If
Next
End Sub

Whereever you type in a number it will trigger this macro to put the appropriate color in the cell below it.

regards
Derek
 
Upvote 0
Not sure there is a formula driven method of colouring cells (or the other way return a value for a specific colour which I think would be handy). A macro could do it (if range("A1")= 2 then range("B2").interiorcolor=2 or whatever)

Think the only way to do would be to use conditional formatting in the format menu.

(y)
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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