View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Joshua Fandango Joshua Fandango is offline
Member
 
Location: In a hole in the ground there lived Joshua Fandango
Posts: 30
Default Workbook_SheetActivate only works on some sheets

A further update...

I put an MsgBox at the start of the Workbook_SheetActivate sub and it
does show when any sheet is activated, but if I add a breakpoint to
this line (or any other) the MsgBox shows and the code doesn't
interrupt on the same 2 sheets - but breaks as expected on any other
sheet.

On 24 Dec, 11:11, Joshua Fandango
wrote:
Hi Per,

I've just tested & I can't trigger anything in the Worksheet_Activate
event of the 2 worksheets either - any others are fine.
There are currently no events in any sheet modules.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'Prevent paste of incorrect NHS Number to Activity sheet
Dim GetData As New DataObject
* With Application
* * If .CutCopyMode = 1 Then
* * * GetData.GetFromClipboard
* * * If ActiveSheet.Name = "Activity" And ChkNHSNum2(Left
(GetData.GetText, 10)) < "Valid NHS Number" Then
* * * * 'For some reason 10 character string = len 12 - maybe 2k for
the clipboard?
* * * * * .CutCopyMode = 0
* * * End If
* * End If
* End With
End Sub

Cheers,
JF

On 24 Dec, 11:02, Per Jessen wrote:



Hi JF


Post the code, as ít might be something in the code...


Regards,
Per


On 24 Dec., 11:51, Joshua Fandango
wrote:


Hi guys,


The Workbook_SheetActivate event is only triggering on some sheets in
a workbook - nowhere in the project are events disable so has anyone
an idea what could be preventing it working on all sheets?


I've had a good search aroung G Groups etc. but can't find anything
similar.


The 2 sheets out of 5 that it doesn't trigger on are different from
the others as they are protected and have hidden rows & columns but
unprotecting/unhiding has made no difference.


Any thoughts greatfully received.


Merry Christmas,
JF- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -