Hi, let's assume everytime Im clicking a cell in Excel, It should intersect the column and row...It can be highlighted with any color or simply default...how to do it..?thanks for the help.
Printable View
Hi, let's assume everytime Im clicking a cell in Excel, It should intersect the column and row...It can be highlighted with any color or simply default...how to do it..?thanks for the help.
VB Code:
[color="#0000A0"]Private[/color] [color="#0000A0"]Sub[/color] Worksheet_SelectionChange([color="#0000A0"]ByVal[/color] Target [color="#0000A0"]As[/color] Range) Cells.Interior.ColorIndex = 0 Columns(Target.Column).Interior.ColorIndex = 36 Rows(Target.Row).Interior.ColorIndex = 36 [color="#0000A0"]End[/color] [color="#0000A0"]Sub[/color]
I've commented out the first line coz i do not want my original color to be erased...but for this:
whenever i remove my cursor to other cell, the yellow lines seems to be jus there. they do not disappear away.how can u change it? What I actually wanted was only the y and -x axis but urs has also -y and x axis..can it be removed?? Thanks for helping.;)PHP Code:Columns(Target.Column).Interior.ColorIndex = 36
Rows(Target.Row).Interior.ColorIndex = 36
First off, the Cells.Interior.ColorIndex = 0" line clears all of the cells colours which have been set, i.e. for every cell in the active worksheet, the interior colour is set back to the default white background.
Next up, try this code:
[Highlight=VB]VB Code:
[color="#0000A0"]Private[/color] [color="#0000A0"]Sub[/color] Worksheet_SelectionChange([color="#0000A0"]ByVal[/color] Target [color="#0000A0"]As[/color] Range) [color="#0000A0"]Dim[/color] rngActiveCell [color="#0000A0"]As[/color] Range [color="#0000A0"]Set[/color] rngActiveCell = Range(CStr(Mid(ActiveCell.Address, 2, CInt(InStr(Right(ActiveCell.Address, _ CInt(Len(ActiveCell.Address) - 1)), "$") - 1))) & ActiveCell.Row) Cells.Interior.ColorIndex = 0 Range(CStr(Mid(Target.Address, 2, CInt(InStr(Right(Target.Address, CInt(Len(Target.Address) - 1)), _ "$") - 1))) & "1:" & CStr(Mid(Target.Address, 2, CInt(InStr(Right(Target.Address, _ CInt(Len(Target.Address) - 1)), "$") - 1))) & Target.Row).Interior.ColorIndex = 36 Range("A" & Target.Row & ":" & CStr(Mid(Target.Address, 2, CInt(InStr(Right(Target.Address, _ CInt(Len(Target.Address) - 1)), "$") - 1))) & Target.Row).Interior.ColorIndex = 36 rngActiveCell.Select [color="#0000A0"]End[/color] [color="#0000A0"]Sub[/color]
Thanks for ur codes....Im having problems when I need to use it over a pivot table which is "protected". It needs to be.. coz I do not want users to make changes to it..Anyway,thanks for ur help n if I have any prob on the way, I'll get back to u buddy..
Cheers
ITboy