clicking on a cell on one sheet will copy that row's data to another sheet

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, I'm not sure how to go about getting this to work as needed. I get different size reports sent to me like the one in "report" tab. It can vary in how many rows, but this is a sample of how it gets to me. when I click on any cell in column A with data, (Order# row) I want that row to copy over to the Data tab below the last entry in the table. Thanks for any help provided.

Book1.xlsx
ABCDEFGHI
1Order #PO #Sales Order #Ship ToCityStateZipcodeCarrierTracking
202971697042220223THE EYE CENTER OF N. FLORIDAPANAMA CITYFL32405FDEG548407254179, 548407254180, 548407254190, 548407254205, 548407254216, 548407254227
302972523032520224/0425032520224/0425CALLAHAN EYE HOSPITALBIRMINGHAMAL35233-181FDEG548407254098, 548407254102
402972534042520221042520221THE EYE CENTER OF N. FLORIDAPANAMA CITYFL32405FDEG548407254113, 548407254124, 548407254135, 548407254146, 548407254157, 548407254168
502973094042620221042620221NORWICH OPHTHALMOLOGY GROUPNORWICHCT06360FDEG548407254282, 548407254293
602973097042620222042620222OC EYE ASSOCIATESIRVINECA92606FDEG548407254308
report


Book1.xlsx
ABCDEFGHIJKLMNOPQR
1
2ORDERPO#SALES ORDER NUMBERSHIP TOCITYSTATEZIPCARRIERTRACKING Column3Column4 Column5 Column6 Column7 Column8 Column9 Column10 Column11
3297169742220223THE EYE CENTER OF N. FLORIDAPANAMA CITYFL32405FDEG548407254179, 548407254180, 548407254190, 548407254205, 548407254216, 548407254227$ -$ -$ -$ -$ -$ -$ -$ -$ -
Data
Cell Formulas
RangeFormula
R3R3=[@Column9]-[@Column10]
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I found this code online but cannot get it to work. Any ideas?

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


If Target.Column = 1 Then
    On Error Resume Next
    Target.EntireRow.Copy Sheets("report").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)


    If Err.Number <> 0 Then
        Target.EntireRow.Copy Sheets("data").Range("A1")
    End If
    On Error GoTo 0

End If

End Sub
 
Upvote 0
How about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   If Target.Column = 1 Then
      Target.EntireRow.Copy Sheets("Data").Cells(rows.Count, "A").End(xlUp).Offset(1)
   End If
End Sub
This needs to go in the Report sheet code module.
 
Upvote 0
Thank you for your time in looking at this Fluff. I appreciate it. I have the DATA page in a table format, is there a way to have the new rows, as they are copied over, extend the table. if that makes sense?
 
Upvote 0
Ok, how about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   Dim LstRw As ListRow
   If Target.Column = 1 Then
      Cancel = True
      Set LstRw = Sheets("Data").ListObjects(1).ListRows.Add
      Target.Resize(, 9).Copy LstRw.Range(1)
   End If
End Sub
 
Upvote 0
Solution
Ok, how about
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   Dim LstRw As ListRow
   If Target.Column = 1 Then
      Cancel = True
      Set LstRw = Sheets("Data").ListObjects(1).ListRows.Add
      Target.Resize(, 9).Copy LstRw.Range(1)
   End If
End Sub
Excellent, Thank you again! this will work as needed. Have a great day.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top