LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to use VB for multiple conditions

This is coded for data entry on column A. Put this event macro in the
worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
codes = ("V,F,A,OC,CO,O1,O2,O3,O4,O5,O6,O7,O8")
Acodes = Split(codes, ",")
Set t = Target
Set a = Range("A:A")
If Intersect(t, a) Is Nothing Then Exit Sub
v = t.Value
For i = LBound(Acodes) To UBound(Acodes)
If v = Acodes(i) Then
t.Interior.ColorIndex = i
End If
Next
End Sub
--
Gary''s Student - gsnu200828


"OsmoseTom" wrote:

I need some help. I need to change the color of a cell based on values from
a list. The list options are V, F, A, OC, CO, O1, O2, O3, O4, O5, O6, O7, &
O8. Each option would have to be a different color. Can this be done using
VB code for the current worksheet? If so how? Thanks...

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting multiple conditions to return a figure from multiple cells Sapper Excel Discussion (Misc queries) 4 April 26th 09 10:33 PM
SUMPRODUCT or INDEX/MATCH for multiple conditions and multiple rec TravisB Excel Discussion (Misc queries) 21 March 16th 07 09:49 PM
Copy multiple collumns with multiple conditions. goober[_6_] Excel Programming 0 October 22nd 05 06:52 AM
Combining Text from multiple cells under multiple conditions KNS Excel Worksheet Functions 2 June 15th 05 11:00 PM
How to multiple conditions to validate more than 2 conditions to . Bhuvana Govind Excel Worksheet Functions 1 January 28th 05 07:07 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"