Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default 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
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
activate cell varun Excel Worksheet Functions 1 February 5th 09 08:18 AM
how to activate a cell if it contains data Joe New Users to Excel 1 December 5th 07 04:40 PM
Event Macro - On Cell Activate - Change Cell Format [email protected][_2_] Excel Programming 7 November 7th 07 03:36 AM
Workbook.Activate / Window.Activate problem Tim[_44_] Excel Programming 3 February 3rd 06 11:38 PM
Activate Cell Brett Excel Discussion (Misc queries) 2 March 29th 05 06:20 PM


All times are GMT +1. The time now is 10:52 AM.

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

About Us

"It's about Microsoft Excel"