View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
R.VENKATARAMAN R.VENKATARAMAN is offline
external usenet poster
 
Posts: 30
Default Workbook_SheetSelectionChange

in a programme visualised by me I make a selection change (in the sense I
activate a cell) in a particular sheet and fire some code. this is ok. but
subequently in the same programme I want to activate another sheet
(sh.name changes) and a cell in that sheet is activated and some other code
is fired. is it possible ?


a trivial example is given below
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
'i activated sheet2 and activate a cell in that sheet
If Sh.Name = "sheet1" Then GoTo line1
If Sh.Name = "sheet2" Then GoTo line2
line1:
Range("a1") = 12345
GoTo line3
line2:
Range("a1") = 4567
line3:
End Sub

when i activate the sheet2 makes selection change in that sheet and thus
fire the code it does not go to line 2 but only goes to line1. in both the
sheets range("a1") is entered by 12345 only. perhaps I have not understood
this event procedure. .