Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default how do i copy data from one sheet to another by d clicking a cell

i have two worksheets. one store inventory and one sales reciept. all
products have item number in first column. when i sell an item, i want to be
able to double click that cell and auto copy other data in that row to the
sales reciept worksheet.
thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default how do i copy data from one sheet to another by d clicking a cell

I think this will do the trick for you. Put this in the sheet's code section
for the sheet where you want to do the double-click trick. Hopefully code is
commented well enough so you can see what you need to change for your
real-world setup.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
'How to insert code into worksheets:
'http://www.jlathamsite.com/Teach/WorksheetCode.htm


'name of Sales Record Sheet
Const Destination = "Sheet2" '<- Change
'Column ID where to paste on the
' Sales Record Sheet to receive the copy
Const DestColumn = "A" '<- change?
'Column ID to be double-clicked to cause move
Const DblClkColumn = "A" '<- Change?
Dim DestRange As Range

If Target.Cells.Count 1 Then
'not sure how, but if...
Exit Sub
End If
If Target.Column < Range(DblClkColumn & Target.Row).Column Then
Exit Sub
End If
'copy from column A to last used cell in row
Range("A" & Target.Row & ":" & _
Range("IV" & Target.Row).End(xlToLeft).Address).Copy
'determine where to paste on destination sheet
Set DestRange = Worksheets(Destination).Range(DestColumn & _
"65536").End(xlUp).Offset(1, 0)
'paste all - could use xlPasteValues here instead
DestRange.PasteSpecial xlPasteAll
Cancel = True ' cancel actual double-click action
Application.CutCopyMode = False
End Sub


"YaYa" wrote:

i have two worksheets. one store inventory and one sales reciept. all
products have item number in first column. when i sell an item, i want to be
able to double click that cell and auto copy other data in that row to the
sales reciept worksheet.
thanks

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
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 parag Excel Worksheet Functions 3 June 15th 06 10:29 PM
if and then formula tiggatattoo Excel Worksheet Functions 2 June 8th 06 08:43 PM
copy data from various sheets into one sheet vik Excel Worksheet Functions 2 April 14th 06 08:17 PM
Input cell reference is not valid (One Variable Data Table) Dottore Excel Worksheet Functions 9 September 1st 05 03:05 PM


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

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

About Us

"It's about Microsoft Excel"