Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Quick ? - Worksheet_BeforeDoubleClick

Hi

I'm trying to use the above in two different sheets, but referencing the
same cell on these different sheets. The macro that is called is different
but it's coming back with a "Run-time error '13': Type Mismatch"

So at the moment, if the Target.Address is "$E$6" on both then it doesnt
work. If i instead change it to an unused cell on the second sheet,
"$E$100", then it works.

Is there anyway around this so that i can leave the target addresses the
same or do i need move it all down to cells that haven't already been used
and on sheet1 and hide everything in between?

cheers

Adam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Quick ? - Worksheet_BeforeDoubleClick

Try the below workbook event instead of the worksheet event...Double click
'This Workbook' from VBE left treeview and check out the below event. Sh
returns the sheet name and Target returns the target range.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Then
' do something
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Adam" wrote:

Hi

I'm trying to use the above in two different sheets, but referencing the
same cell on these different sheets. The macro that is called is different
but it's coming back with a "Run-time error '13': Type Mismatch"

So at the moment, if the Target.Address is "$E$6" on both then it doesnt
work. If i instead change it to an unused cell on the second sheet,
"$E$100", then it works.

Is there anyway around this so that i can leave the target addresses the
same or do i need move it all down to cells that haven't already been used
and on sheet1 and hide everything in between?

cheers

Adam

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Quick ? - Worksheet_BeforeDoubleClick

Hi Jacob

I've just relised that it's because I'm trying to get the double click to
work on a merged cell. If I unmerge, it works fine.

apologies for wasting your time

Adam

"Jacob Skaria" wrote:

Try the below workbook event instead of the worksheet event...Double click
'This Workbook' from VBE left treeview and check out the below event. Sh
returns the sheet name and Target returns the target range.

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Then
' do something
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Adam" wrote:

Hi

I'm trying to use the above in two different sheets, but referencing the
same cell on these different sheets. The macro that is called is different
but it's coming back with a "Run-time error '13': Type Mismatch"

So at the moment, if the Target.Address is "$E$6" on both then it doesnt
work. If i instead change it to an unused cell on the second sheet,
"$E$100", then it works.

Is there anyway around this so that i can leave the target addresses the
same or do i need move it all down to cells that haven't already been used
and on sheet1 and hide everything in between?

cheers

Adam

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
Worksheet_BeforeDoubleClick() Jock Excel Programming 2 April 30th 09 02:58 PM
Worksheet_BeforeDoubleClick Stops Working Minitman Excel Programming 3 November 10th 08 07:58 AM
Worksheet_beforedoubleclick KC Excel Programming 2 October 11th 07 12:40 PM
Sub Worksheet_BeforeDoubleClick from elsewhere? Jack Sons Excel Discussion (Misc queries) 2 November 1st 05 08:22 PM
Quick question - quick answer about assigning shortcut keys funkymonkUK[_75_] Excel Programming 1 October 13th 05 10:50 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"