Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Run Event Code In General Module

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

ActiveCell.EntireRow.Interior.ColorIndex = 6

If z = Empty Then
ElseIf Not z = ActiveCell.Row Then
Rows(z).EntireRow.Interior.ColorIndex = xlColorIndexNone
End If

z = ActiveCell.Row

End Sub

I run this code with a worksheet. It is perfect. Can I put this code
(or new version) in a module so I can run it in any active sheet, any
active workbook?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Run Event Code In General Module

See Chip Pearson's site on application level events
http://www.cpearson.com/excel/appevent.htm

--
Regards,
Tom Ogilvy



"Who I Am" wrote:

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

ActiveCell.EntireRow.Interior.ColorIndex = 6

If z = Empty Then
ElseIf Not z = ActiveCell.Row Then
Rows(z).EntireRow.Interior.ColorIndex = xlColorIndexNone
End If

z = ActiveCell.Row

End Sub

I run this code with a worksheet. It is perfect. Can I put this code
(or new version) in a module so I can run it in any active sheet, any
active workbook?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Run Event Code In General Module

Event code can not be placed in a standard module. However what you want to
do has been taken care of in thisworkbook. The code will look like this...

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)

End Sub

That being said take a look at Chip's row highliter. It is kinda cool...

http://www.cpearson.com/excel/excelM...ightActiveCell

--
HTH...

Jim Thomlinson


"Who I Am" wrote:

Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

ActiveCell.EntireRow.Interior.ColorIndex = 6

If z = Empty Then
ElseIf Not z = ActiveCell.Row Then
Rows(z).EntireRow.Interior.ColorIndex = xlColorIndexNone
End If

z = ActiveCell.Row

End Sub

I run this code with a worksheet. It is perfect. Can I put this code
(or new version) in a module so I can run it in any active sheet, any
active workbook?

Thanks


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
Declare a class module in General Declarations Wilbur[_8_] Excel Programming 1 March 12th 06 03:52 PM
WorkBook VS General Module Desert Piranha[_54_] Excel Programming 2 February 24th 06 03:41 AM
Where?Worksheet code module or Worksheet_SelectionChange event han Kenzie Excel Worksheet Functions 4 January 30th 06 09:41 PM
General ?? regarding Macro or Module size in a spreadsheet JohnG[_2_] Excel Programming 3 August 3rd 05 10:43 AM
General protection fault in module HPPCL5F4.DLL at 0002:000006c2. Ben Excel Discussion (Misc queries) 1 January 4th 05 12:05 AM


All times are GMT +1. The time now is 03:32 PM.

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"