-1

I've got two workbooks 1. MonthlyStats and 2. WeeklyStats

I'm looking to copy all non-empty cells there are in 'Sheet1' of 'WeeklyStats' to 'SheetX' of 'MonthlyStats'. The copied data should be inserted as new rows from the last entry in 'SheetX'.

Also, is it possible that the script asks me which row to start inserting data from? That'd be great!

Thanks in advance for your help!

PS:

  1. I'm using Excel 2010
  2. There are no conditions on what to copy from Sheet1 of WeeklyStats. All rows with data in it should be copied over.
pnuts
  • 58,317
  • 11
  • 87
  • 139
CybaTronX
  • 29
  • 6
  • Why do you need VBA? Excel provide the feature of copying and pasting non empty rows. – Pankaj Jaju Dec 27 '13 at 12:35
  • 2
    Try recording a macro and going through the steps manually. Look at the code generated during the recording and that will give you a good place to start! Then you can post back here and show us your code and what you are able to figure out. – Blackhawk Dec 27 '13 at 13:28
  • Would you really want it to ask you where to put the new rows or just add them to the bottom? – PermaNoob Dec 27 '13 at 16:06
  • @PankajJaju - It's because the script will be a part of a greater script that I'm writing. #Blackhawk - Certainly I'll try that #PermaNoob - I'm alright with it adding the rows to the bottom as well. – CybaTronX Dec 27 '13 at 19:08

1 Answers1

0

I personally find the best way to learn VBA is to search and try different codes in order to solve a problem. For your problem, maybe try read the post here:

Copy and Paste a set range in the next empty row

You can then use For each sheet loop to copy weekly stats from different sheets to the monthly stats sheet. Hope it helps

Regarding the question copy non blank cells, try

Worksheets("Sheet1").Activate 
ActiveSheet.UsedRange.Select
Selection.copy
Community
  • 1
  • 1
RL8
  • 20
  • 5