![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I am trying to use VB coding to change the cell shading based upon text data, entered into cells, in a workbook, for the active sheet. There are 6 conditions.
If somebody has some generic code you can e-mail it to trw2264@hotmail.com Thanks for any help! |
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,567
|
Hi
You could try an event macro something like this: Right click your sheet tab, left click View Code, then paste in this code. Alt+F11 returns you to your sheet. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Value = "text1" Then Target.Interior.ColorIndex = 3 If Target.Value = "text2" Then Target.Interior.ColorIndex = 4 If Target.Value = "text3" Then Target.Interior.ColorIndex = 5 If Target.Value = "text4" Then Target.Interior.ColorIndex = 6 If Target.Value = "text5" Then Target.Interior.ColorIndex = 7 If Target.Value = "text6" Then Target.Interior.ColorIndex = 8 End Sub Change "text1" etc to your text that you want to trigger cell colouring. Hope this helps regards Derek |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thany you very much for your help! I will try it out!
Tom |
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|