FOR NateO

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
Hi NateO,

I found your following macro:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cl As Range
Static n As Range
On Error GoTo 1
For Each cl In Range("a" & n.Row, n)
If cl.Interior.ColorIndex = 36 Then _
cl.Interior.ColorIndex = xlNone
Next cl
For Each cl In Range("a" & Target.Row, Target)
If cl.Interior.ColorIndex = xlNone Then _
cl.Interior.ColorIndex = 36
Next cl
1: Set n = Target
End Sub
With your macro above,is it also possible that in the same time the vertical column also can be uplighted.
So when when the row is 8 and the column is F then the row A8 and the column F8 is highlighted.
(the same result as the macro from I.F.MOALA)
but that macro don't work for me.
Thanks for answer
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Howdy Verluc,

While it is possible, it is not recommended. This does not perform well deep in the sheet. The code could look something like:<pre>
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cl As Range
Static n As Range
On Error GoTo 1

'clear formatting of the old row
For Each cl In Range("a" & n.Row, n)
If cl.Interior.ColorIndex = 36 Then _
cl.Interior.ColorIndex = xlNone
Next cl

'clear formatting of the old column
For Each cl In Range(Cells(1, n.Column), n)
If cl.Interior.ColorIndex = 36 Then _
cl.Interior.ColorIndex = xlNone
Next cl

'colour active row
For Each cl In Range("a" & Target.Row, Target)
If cl.Interior.ColorIndex = xlNone Then _
cl.Interior.ColorIndex = 36
Next cl

'colour active column
For Each cl In Range(Cells(1, Target.Column), Target)
If cl.Interior.ColorIndex = xlNone Then _
cl.Interior.ColorIndex = 36
Next cl

1: Set n = Target
End Sub</pre>

Both this and Ivan's code belong in a worksheet module (the appropriate one). Ivan's should work, I would recommend trouble-shooting the problem if you want this functionality.


_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue"> Oliver</font></font></font>
This message was edited by nateo on 2002-09-06 13:42
 
Upvote 0
Hi Verluc

can you post the code you get when you do this;

Turn your macro recoder on and set up a cells condition format as a formula and then for the formula enter TRUE.

thanks
 
Upvote 0

Forum statistics

Threads
1,218,627
Messages
6,143,584
Members
450,494
Latest member
GolfNut39

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top