Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activate data according to the value key in in other cell.
Hi
I need to activate data according to the value key in in other cell. eg: If Then A 1 2 B 1 3 C 2 3 D 1 2 3 if the value is A then 1 and 2 should be highlighted and if B then 1 and 3, if C then 2 and 3 and if D then 1,2 and 3 should be highlighted or viewed |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activate data according to the value key in in other cell.
On May 4, 6:14 pm, "
wrote: Hi I need to activate data according to the value key in in other cell. eg: If Then A 1 2 B 1 3 C 2 3 D 1 2 3 if the value is A then 1 and 2 should be highlighted and if B then 1 and 3, if C then 2 and 3 and if D then 1,2 and 3 should be highlighted or viewed Maybe Conditional Formatting?? Say A,B,C or D can be in $A$1, 1 in $B$1, 2 in $C$1 and 3 in $D$1 Then, after selecting $B$1, go Format|Conditional formatting to bring up the Conditional formatting dialog. Select Formula Is then use this formula... =$A1="C" Then Format the font to be the same color as the cell background color (most likely white) then click OK. Repeat for cell $C$1 using this formula... =$A1="B" Repeat for cell $D$1 using this formula... =$A1="A" With this formatting in place; when $A$1 = A, only the 1 in $B$1 and the 2 in $C$1 will be visible; when $A$1 = "B", only the 1 in $B$1 and the 3 in $D$1 will be vissible, when $A$1 = C, only the 2 in $C$1 and the 3 in $D$1 will be visible; when $A$1 = D the 1 in $B$1, the 2 in $C $1 and the 3 in $D$1 will all be visible. Ken Johnson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Activate data according to the value key in in other cell.
You may also want to consider:
hth Geoff Sub HighLightCells() Dim tbl As Range, tbl2 As Range, rng As Range, rng2 As Range Dim found As Range, found2 As Range '''set search range in col A Set tbl = Range("A1:A" & Range("A65536").End(xlUp).Row) For Each rng In tbl '''find row in col A Set found = tbl.Find(rng.Value, , xlValues, xlWhole, xlNext, xlByRows) If Not found Is Nothing Then Set tbl2 = Range(Cells(found.Row, 2), Cells(found.Row, 4)) For Each rng2 In tbl2 If Not IsEmpty(rng2) And rng2.Value 0 Then Select Case rng.Value Case "A" '''rng2.Font.Color = vbRed '''*****use this rng2.Interior.Color = vbRed '''*****or this Case "B" '''rng2.Font.Color = vbBlue rng2.Interior.Color = vbCyan Case "C" '''rng2.Font.Color = vbGreen rng2.Interior.Color = vbGreen Case "D" '''rng2.Font.Color = vbMagenta rng2.Interior.Color = vbMagenta Case Else End Select End If Next End If Next End Sub " wrote: Hi I need to activate data according to the value key in in other cell. eg: If Then A 1 2 B 1 3 C 2 3 D 1 2 3 if the value is A then 1 and 2 should be highlighted and if B then 1 and 3, if C then 2 and 3 and if D then 1,2 and 3 should be highlighted or viewed |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
activate cell | Excel Worksheet Functions | |||
how to activate a cell if it contains data | New Users to Excel | |||
Event Macro - On Cell Activate - Change Cell Format | Excel Programming | |||
Workbook.Activate / Window.Activate problem | Excel Programming | |||
Activate Cell | Excel Discussion (Misc queries) |