Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Highlighting The Active Cell

This is a Macro for 'Highlighting The Active Cell' that will change
the background color of the ActiveCell to yellow anytime you select a
new cell, either with the mouse or with the arrow keys.


Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object,
ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target

End Sub

The author says that if one wants to make the active cell appear in a
special color, use the following this code in the
Workbook_SheetSelectionChange event of the workbook. BUT, I am not good
with VBA or Macros yet so I do not know what he means ... How do I get
this Macro to work?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Highlighting The Active Cell

Hi Pelham,

This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:

Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)

Select 'View Code' from the menu and paste the code.

Alt-F11 to return to Excel.


---
Regards,
Norman



"Pelham" wrote in message
oups.com...
This is a Macro for 'Highlighting The Active Cell' that will change
the background color of the ActiveCell to yellow anytime you select a
new cell, either with the mouse or with the arrow keys.


Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object,
ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target

End Sub

The author says that if one wants to make the active cell appear in a
special color, use the following this code in the
Workbook_SheetSelectionChange event of the workbook. BUT, I am not good
with VBA or Macros yet so I do not know what he means ... How do I get
this Macro to work?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Highlighting The Active Cell

Hi Norman

Thanks so much!

I am a real rookie to VBA, so can you point me to a summary page of the
different VBA environments because I do not know the difference between
'workbook event code', 'standard module' or 'sheet module' etc.? All I
know about VBA is that you get to the VBE by pressing Alt+F11...!!!

Regards
Pelham


Norman Jones wrote:
Hi Pelham,

This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:

Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)

Select 'View Code' from the menu and paste the code.

Alt-F11 to return to Excel.


---
Regards,
Norman



"Pelham" wrote in message
oups.com...
This is a Macro for 'Highlighting The Active Cell' that will change
the background color of the ActiveCell to yellow anytime you select a
new cell, either with the mouse or with the arrow keys.


Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object,
ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target

End Sub

The author says that if one wants to make the active cell appear in a
special color, use the following this code in the
Workbook_SheetSelectionChange event of the workbook. BUT, I am not good
with VBA or Macros yet so I do not know what he means ... How do I get
this Macro to work?


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
Active cell/row highlighting vikingfan2108 Excel Discussion (Misc queries) 2 March 17th 10 06:31 PM
Highlighting row of active cell question KevHardy Excel Discussion (Misc queries) 4 February 14th 10 02:54 PM
Highlighting Active Cell jpreman Excel Discussion (Misc queries) 0 January 23rd 08 01:49 AM
Highlighting Active Cell? How? skint Excel Discussion (Misc queries) 2 October 9th 06 01:06 AM
Highlighting an active cell pjy Excel Worksheet Functions 1 August 2nd 06 05:36 PM


All times are GMT +1. The time now is 04:27 AM.

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

About Us

"It's about Microsoft Excel"