ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BeforeDoubleClick code (https://www.excelbanter.com/excel-programming/438921-beforedoubleclick-code.html)

Ronbo

BeforeDoubleClick code
 
I would like to put a routine on the worksheet tab using "BeforeDoubleClick"
that would put the contents of the cell clicked on in A1 and the contents of
the cell (OFFSET 1,1) in cell A2.

Thanks,

Ronbo


Ryan H

BeforeDoubleClick code
 
I assume you want the cell 1 row down and 1 row to the right of the double
clicked cell, right? If not just adjust the .Offset numbers.

Hope this helps! If so, let me know, click "YES" below.

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

Cancel = True

Range("A1").Value = Target.Value
Range("A2").Value = Target.Offset(1, 1).Value

End Sub
--
Cheers,
Ryan


"Ronbo" wrote:

I would like to put a routine on the worksheet tab using "BeforeDoubleClick"
that would put the contents of the cell clicked on in A1 and the contents of
the cell (OFFSET 1,1) in cell A2.

Thanks,

Ronbo


Otto Moehrbach[_2_]

BeforeDoubleClick code
 
Something like this perhaps. HTH Otto
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Range("A1") = Target
Range("A2") = Target.Offset(1, 1)
End Sub

"Ronbo" wrote in message
...
I would like to put a routine on the worksheet tab using
"BeforeDoubleClick"
that would put the contents of the cell clicked on in A1 and the contents
of
the cell (OFFSET 1,1) in cell A2.

Thanks,

Ronbo


L. Howard Kittle

BeforeDoubleClick code
 
Try either of these.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
With ActiveCell
.Copy Range("A1")
.Offset(1, 1).Copy Range("A2")
End With
End Sub

or

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
ActiveCell.Copy Range("A1")
ActiveCell.Offset(1, 1).Copy Range("A2")
End Sub

HTH
Regards,
Howard

"Ronbo" wrote in message
...
I would like to put a routine on the worksheet tab using
"BeforeDoubleClick"
that would put the contents of the cell clicked on in A1 and the contents
of
the cell (OFFSET 1,1) in cell A2.

Thanks,

Ronbo





All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com