LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default SheetSelectionChange

I am having difficulty using the SheetSelectionChange event which refers to a
dynamic range.
The range dimension is increased or reduced by adding or deleting wsheets.
Selecting a range.row. activates the corresponding wsheet.
If I increase the range by adding new wsheets the event always fires
correctly.
If I reduce the range by deleting a wsheet the event does not fire again
even when I add another wsheet.

Mysteriously I had it working properly without having to save and re-open
the wbook but I cannot repeat this.

I would appreciate any guidance on this please. T.I.A.

Geoff

This code is in a class module:
Dim WithEvents oApp As Application

Private Sub Class_Initialize()
Set oApp = Application
End Sub

Private Sub oApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
If Not Intersect(Target, Range(Cells(startRow , startCol), Cells(endRow,
endCol))) Is Nothing Then
Sheets(Target.Row).Activate
End If
End Sub

This code is in the ThisWorkBook module:
Dim oAppEvents As CAppEvents

Private Sub Workbook_Open()
Set oAppEvents = New CAppEvents
End Sub

 
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
SheetSelectionChange Event find out previosly selected cell Anton Sommer Excel Programming 2 August 8th 05 10:04 PM
SheetSelectionChange Frank Kabel Excel Programming 0 April 26th 04 04:28 PM
SheetSelectionChange Target size Limitation? Guillaume E. Excel Programming 1 September 27th 03 04:34 PM


All times are GMT +1. The time now is 07:06 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"