ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Double Click Copy (https://www.excelbanter.com/excel-programming/279443-double-click-copy.html)

Larry Moores

Double Click Copy
 
I have a question whether a certain funcionality can be
incorporated into a spreadsheet. I have an estimate
worksheet into which I want to copy and paste a data line
from a seperate worksheet which I call the production
database. What I would like to be able to do is have both
sheets open at once, go to the database line I want to
have copied into the estimate sheet, then just doubleclick
somehwhere on that line and have it copy to the active
cell line on the estimate sheet. I can do it with a macro
button, but would really just like to be able to double
click on the line itself . Thank you.

Larry

Tom Ogilvy

Double Click Copy
 
Use the beforedoubleclick event of that worksheet

Go to the sheet tab and right click; select view code

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
if target.count 1 then exit sub
for each wkbk in Workbooks
if wkbk.Windows(1).Visible then
if wkbk.Name < thisworkbook.Name
exit for
end if
end if
Next
target.EntireRow.copy Destination:=
Wkbk.Worksheets(1).Cells(rows.count,1).End(xlup)(2 )
Cancel = True
End Sub


the above represents a basic start. You would have to modify it to suit
your needs. As written it assumes only two workbooks are open and visible,
so the one not containing the code would be the location for pasting.

--
Regards,
Tom Ogilvy


"Larry Moores" wrote in message
...
I have a question whether a certain funcionality can be
incorporated into a spreadsheet. I have an estimate
worksheet into which I want to copy and paste a data line
from a seperate worksheet which I call the production
database. What I would like to be able to do is have both
sheets open at once, go to the database line I want to
have copied into the estimate sheet, then just doubleclick
somehwhere on that line and have it copy to the active
cell line on the estimate sheet. I can do it with a macro
button, but would really just like to be able to double
click on the line itself . Thank you.

Larry





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

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