Double Click Copy

  • Thread starter Thread starter Larry Moores
  • Start date Start date
L

Larry Moores

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
 
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.
 
Back
Top