Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Highlight column heading of current cell

I have searched and cannot find an answer. I am using Excel 2000 and
would like to create a function that will highlight a column heading in
row three if the current cell is in that particular column. Let's say I
have 10 columns. If I am at a cell in any row in column 2, then
highlight cell B2 else leave white. Is this possible via vba? How?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Highlight column heading of current cell

Hi C,

Try:
'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("B3")
If Target.Column = 2 Then
.Interior.ColorIndex = 6
Else
.Interior.ColorIndex = xlNone
End If
End With
End Sub
'<<=============
This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



wrote in message
oups.com...
I have searched and cannot find an answer. I am using Excel 2000 and
would like to create a function that will highlight a column heading in
row three if the current cell is in that particular column. Let's say I
have 10 columns. If I am at a cell in any row in column 2, then
highlight cell B2 else leave white. Is this possible via vba? How?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Highlight column heading of current cell

Hi C,

I should add that you indicate the header row to be row 3:

function that will highlight a column heading in row three


But, later, you say:

If I am at a cell in any row in column 2, then highlight cell B2


My code assumes the first definition. If, however, the header row is row 2,
change:

With Range("B3")


to

With Range("B2")



---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi C,

Try:
'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("B3")
If Target.Column = 2 Then
.Interior.ColorIndex = 6
Else
.Interior.ColorIndex = xlNone
End If
End With
End Sub
'<<=============
This is worksheet event code and should be pasted into the worksheets's
code module (not a standard module and not the workbook's ThisWorkbook
module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Highlight column heading of current cell

right click sheet tabview codecopy/paste this. Be aware that it will erase
all others.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlColorIndexNone
Cells(3, Target.Column).Interior.ColorIndex = 36
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
I have searched and cannot find an answer. I am using Excel 2000 and
would like to create a function that will highlight a column heading in
row three if the current cell is in that particular column. Let's say I
have 10 columns. If I am at a cell in any row in column 2, then
highlight cell B2 else leave white. Is this possible via vba? How?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Highlight column heading of current cell

Hi Don,

I suspect that your interpretation is the correct one!


---
Regards,
Norman



"Don Guillett" wrote in message
...
right click sheet tabview codecopy/paste this. Be aware that it will
erase all others.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlColorIndexNone
Cells(3, Target.Column).Interior.ColorIndex = 36
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
I have searched and cannot find an answer. I am using Excel 2000 and
would like to create a function that will highlight a column heading in
row three if the current cell is in that particular column. Let's say I
have 10 columns. If I am at a cell in any row in column 2, then
highlight cell B2 else leave white. Is this possible via vba? How?







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Highlight column heading of current cell

Thanks Don, that did the trick. Just could not find the right syntax.
You're awsome!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Highlight column heading of current cell

Aw shucks, glad to help.

--
Don Guillett
SalesAid Software

wrote in message
ups.com...
Thanks Don, that did the trick. Just could not find the right syntax.
You're awsome!



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
highlight row/column to track current cell ... and more! prupp New Users to Excel 3 February 11th 08 07:25 PM
how to highlight current row & column automatically by a color asif4u Excel Discussion (Misc queries) 8 June 12th 07 04:42 PM
highlight current row/column RyanV Excel Discussion (Misc queries) 1 August 11th 06 01:56 PM
how do I highlight the current row and column Ssalzman Excel Discussion (Misc queries) 4 March 31st 06 12:11 AM
how to highlight current row & column automatically by a color iffi Excel Discussion (Misc queries) 1 February 6th 05 06:30 PM


All times are GMT +1. The time now is 04:17 PM.

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"