Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Detecting double click

I'm using the following to launch some VBA when a cell is double
clicked.

++++++++
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String

Set rng
=Worksheets("Sheet1").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row

rows = "J1:J" & MyLastRow

If Not Intersect(Target, Range(rows)) Is Nothing Then
Cancel = True

********* Code here

End If


End Sub
++++++++++

Howver, I'd like to change that so any cell in the range S2 to CD5972
achieves the same result.

Is that possible?
Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Detecting double click

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim sAddr as String
sAddr = "S2:CD5972"
If Not Intersect(Target, Range(s)) Is Nothing Then
Cancel = True

********* Code here

End If
End Sub

--
Regards,
Tom Ogilvy

"kirkm" wrote in message
...
I'm using the following to launch some VBA when a cell is double
clicked.

++++++++
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String

Set rng
=Worksheets("Sheet1").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row

rows = "J1:J" & MyLastRow

If Not Intersect(Target, Range(rows)) Is Nothing Then
Cancel = True

********* Code here

End If


End Sub
++++++++++

Howver, I'd like to change that so any cell in the range S2 to CD5972
achieves the same result.

Is that possible?
Thanks - Kirk



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Detecting double click

Kirk,

Excuse me for horning in, but I believe Tom meant the line to be:

If Not Intersect(Target, Range(sAddr)) Is Nothing Then

hth,

Doug

"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim sAddr as String
sAddr = "S2:CD5972"
If Not Intersect(Target, Range(s)) Is Nothing Then
Cancel = True

********* Code here

End If
End Sub

--
Regards,
Tom Ogilvy

"kirkm" wrote in message
...
I'm using the following to launch some VBA when a cell is double
clicked.

++++++++
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String

Set rng
=Worksheets("Sheet1").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row

rows = "J1:J" & MyLastRow

If Not Intersect(Target, Range(rows)) Is Nothing Then
Cancel = True

********* Code here

End If


End Sub
++++++++++

Howver, I'd like to change that so any cell in the range S2 to CD5972
achieves the same result.

Is that possible?
Thanks - Kirk





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Detecting double click

Thanks VERY much to both of you.

That's working wonderfully

Cheers - Kirk
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Detecting double click

Yes I did. Thanks for the correction. That is the second time I have done
that <blush (this week).

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote:

Kirk,

Excuse me for horning in, but I believe Tom meant the line to be:

If Not Intersect(Target, Range(sAddr)) Is Nothing Then

hth,

Doug

"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim sAddr as String
sAddr = "S2:CD5972"
If Not Intersect(Target, Range(s)) Is Nothing Then
Cancel = True

********* Code here

End If
End Sub

--
Regards,
Tom Ogilvy

"kirkm" wrote in message
...
I'm using the following to launch some VBA when a cell is double
clicked.

++++++++
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String

Set rng
=Worksheets("Sheet1").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row

rows = "J1:J" & MyLastRow

If Not Intersect(Target, Range(rows)) Is Nothing Then
Cancel = True

********* Code here

End If


End Sub
++++++++++

Howver, I'd like to change that so any cell in the range S2 to CD5972
achieves the same result.

Is that possible?
Thanks - Kirk








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Detecting double click

Well, I usually make tow typos in each anwser <g

Doug

"Tom Ogilvy" wrote in message
...
Yes I did. Thanks for the correction. That is the second time I have
done
that <blush (this week).

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote:

Kirk,

Excuse me for horning in, but I believe Tom meant the line to be:

If Not Intersect(Target, Range(sAddr)) Is Nothing Then

hth,

Doug

"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim sAddr as String
sAddr = "S2:CD5972"
If Not Intersect(Target, Range(s)) Is Nothing Then
Cancel = True

********* Code here

End If
End Sub

--
Regards,
Tom Ogilvy

"kirkm" wrote in message
...
I'm using the following to launch some VBA when a cell is double
clicked.

++++++++
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String

Set rng
=Worksheets("Sheet1").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row

rows = "J1:J" & MyLastRow

If Not Intersect(Target, Range(rows)) Is Nothing Then
Cancel = True

********* Code here

End If


End Sub
++++++++++

Howver, I'd like to change that so any cell in the range S2 to CD5972
achieves the same result.

Is that possible?
Thanks - Kirk







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
How to change syperlink from single click to double click syperlinker Excel Worksheet Functions 0 June 13th 08 05:01 PM
Detecting Double Entries comparini3000 Excel Programming 1 June 14th 06 12:26 AM
userform label double-click goes to click event John Paul Fullerton Excel Programming 3 May 19th 06 05:54 PM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM


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