copy data from one sheet to another to the next open row down

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, I use this code in VBA to transfer data from one sheet to another when i click an option button. It however deletes the sheet each time I transfer new data. I need it to keep the old data, and trnasfer the new data to the next open row down? Thanks for all help.

Code:
Sub cpyToComplete()
     
Application.ScreenUpdating = False
Dim CopySheet As Worksheet
Dim PasteSheet As Worksheet


Set CopySheet = Worksheets("FXF CALL IN LOG")
Set PasteSheet = Worksheets("Complete")


PasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0).Value = Sheets("FXF CALL IN LOG").Range("I1").Value
CopySheet.Range("A2:I500").Copy
PasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues


Sheets("Complete").Select
Sheets("Complete").Range("J1").Select
Sheets("FXF CALL IN LOG").Select
Sheets("FXF CALL IN LOG").Range("J4").Select


Application.CutCopyMode = False
Application.ScreenUpdating = True


End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
That code doesn't delete any sheets.
 
Upvote 0
That code doesn't delete any sheets.

Fluff, Thanks for looking at this. Let me try to explain a bit better. The data entered on the 'FXF CALL IN LOG' sheet will change throughout the day. When new data is sent to the COMPLETE sheet, I want it to be saved for history on the next open row down. Currently if I send new data, it clears the COMPLETE sheet and just shows the new data. Make more sense?
 
Upvote 0
Make more sense?
Nope ;)
At no point is that code clearing any data.
It is pasting the new data into the first blank row in col A.
 
Upvote 0
Nope ;)
At no point is that code clearing any data.
It is pasting the new data into the first blank row in col A.

Sorry Fluff for my bad explanation. A user enters data into the FXF CALL IN LOG sheet, This is transferred to the complete sheet. The FXF sheet is cleared and ready for new data. New data is entered into the FXF sheet, when copied to the Complete sheet need it to keep the old data that has been transferred earlier? The complete sheet needs to be a running history of all data copied over?
 
Upvote 0
And that's exactly what your code does.
does col A have values in every row?
 
Upvote 0
Fluff, I'm embarrassed, I had been playing around with my copy of this and accidentally changed some ranges, it was overwriting the data in the complete sheet. I changed everything back and it is working now. I really appreciate the time you spent looking at this.
 
Upvote 0
Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,539
Members
449,038
Latest member
Guest1337

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