• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Append daily data entry from one sheet to Master sheet in SAME workbook

spk1009

New Member
This is probably a very easy solution but I just can't get my finger on it....


I have ONE workbook with 2 tabs (Master) and (Daily), and each day there is any entries in the daily tab needs to be appended to the bottom of the master tab (append to existing data in Master tab. BUT then I need to delete the daily entries from the daily tab after the append.


Here is a sample file:

http://speedy.sh/qJNUX/MasterTab-SAMPLE.xlsx
 
I'd start by recording a macro of you selecting the data from Daily, going to Master sheet, getting to end(*) and pasting, then clearing data from Daily sheet. Run macro as needed.


(*) To find last row with data, you can use something like this:

[pre]
Code:
LastRow = Worksheets("Master").Range("A2").End(xlDown).Row
[/pre]
You would then copy the data from Daily into the next row.


As you said, it's an easy solution, so give it a shot. If you can't get it, we can help you further.
 
Thank you for the reply..but I'm not sure I totally understand what you mean.


I created a macro to copy all cells with data, copy and go to master tab but not sure to find the last row and paste the data. Thank you


Sub AppData()

'

' AppData Macro

'

' Keyboard Shortcut: Ctrl+q

'

Range("A2").Select

Range(Selection, Selection.End(xlToRight)).Select

Range(Selection, Selection.End(xlDown)).Select

Range("A2:H276").Select

Selection.Copy

Sheets("Master").Select

Range("A11").Select

Application.CutCopyMode = False

ActiveWorkbook.Save


End Sub
 
(having more time to work on this) Here's the macro I believe you need.

[pre]
Code:
Sub AppData()
Dim DailyData As Range

'Finds where is the data to copy
Set DailyData = Worksheets("Daily").Range("H2", Worksheets("Daily").Range("A2").End(xlDown))

'Note the use of the End to find where to copy to
DailyData.Copy Worksheets("Master").Range("A2").End(xlDown).Offset(1, 0)

'Clear old data
DailyData.ClearContents
End Sub
[/pre]
 
This works PERFECT!!! Thank you so muhc, Luke M!


I have another workbook where the "Daily" worksheet has GroupA and GroupB records and I need to append GroupA into Master-GrpA and GroupB into Master-GrpB.


Would this macro work for this workbook also with a code "tweak"?


Thank you!
 
Certainly. Note that the first two lines of code are simply defining where the data is you want to copy, and then where you want to go. The 2nd line can simply be tweaked by changing the name of the worksheet. I'm not sure how you have the data in Daily worksheet grouped, but once you know how that's done, you should be able to define the ranges you want to copy.
 
Back
Top