Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color cel when entering other cel

Status
Not open for further replies.

jajinder

Technical User
Mar 11, 2004
88
NL
Hi... In the endless search on the net I got tired and frustrated, so I hope one of you can help me.

Question: When I click on Cell(C1) I want that Cell(A1)colors. Please help me.

Greets Jajinder
 
What would happen when you click out of C1? Are you typing into C1? Is there anything in A1?
 
Just entering the cell, so I thougt something like this:

Private Sub Cell_SelectionChange(Byval Target as Range)...

but that didn't work

Thus: When I click on Cell(C1), (A1) colors bleu (whatever color)

Greets Jajinder
 
the selection change sub is definitely the way to go but you need to reference the TARGET


if TARGET.address = "$C$1" then
Range("A1").interior.colorindex = 5
else
end if

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Private Sub Worsheet_SelectionChange(ByVal Target As Range)
If Target.Address = "C1" then
Range("A1").Interior.ColorIndex = 5
Else

(A1) now = blue

I think that my question was nog described very wel: I want it to be variable: Means: When I click om
(C1)-->(A1)=Blue
(C2)-->(A2)=Blue -->(C1)turns White
(C3)-->(A3)=Blue -->(C1)&(C2)turn White
etc... etc... etc...

Greets Jajinder
 
Well use some logic then !!

If Target.Column = 3 Then
Columns(1).Interior.ColorIndex = 0
Range("A" & Target.Row).Interior.ColorIndex = 5
Else
End If


Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Hé, hé, hé....

My VBA ain't that wel, just a beginner, but I'm learning fast. Learned something again thanx to you.

Everything is logical if you know the details... ain't it? :p

Anyway, thanx for the solution works great.. ;)

Greets Jajinder
 
F1 F1 F1 F1
Look at TARGET and RANGE - check out the properties for both

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
The best solution:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column <> 3 Then
Columns(1).Interior.ColorIndex = 0
Else
Columns(1).Interior.ColorIndex = 0
Range("A" & Target.Row).Interior.ColorIndex = 5
End If
End Sub

Sorry... I have the Dutch version of F1... that realy sux, but like I said I'm learning much from guys like you.. Just bussy for 2 months..

Greets Jajinder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top