Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Declare a class module in General Declarations | Excel Programming | |||
WorkBook VS General Module | Excel Programming | |||
Where?Worksheet code module or Worksheet_SelectionChange event han | Excel Worksheet Functions | |||
General ?? regarding Macro or Module size in a spreadsheet | Excel Programming | |||
General protection fault in module HPPCL5F4.DLL at 0002:000006c2. | Excel Discussion (Misc queries) |