ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to pull/add data and populate new sheet (https://www.excelbanter.com/excel-programming/447773-macro-pull-add-data-populate-new-sheet.html)

JonathanK1

Macro to pull/add data and populate new sheet
 
Hello,

I'm back (again). This may be challenging. I have a worksheet with a table (dates on one axis, products on another). On the last worksheet I have a command button. What I want the button to do is populate a new Excel sheet (in a new window) with all of the products – but with 6 months’ worth of data.

So, currently, the table looks like this (for example):

January 1 January 2 January 3 January 4
Product 1

Product 2

Product 3

Product 4

I want the command button to populate a new Excel with a list of the products (Product, 1, Product 2, etc.) but with the next columb of cells having 6 months’ worth of data – which means it will have to add up the columns with the dates (the dates are by day, so it’ll have to add up quite a few columns).

Is this even possible? I have the simple macro below, but it just populates a new excel without any of the data in it.

Sub Newbook12()
MyBook = ActiveWorkbook.Name
Workbooks.Add
ThatBook = ActiveWorkbook.Name
Workbooks(MyBook).Activate
End Sub

Spencer101

Quote:

Originally Posted by JonathanK1 (Post 1607797)
Hello,

I'm back (again). This may be challenging. I have a worksheet with a table (dates on one axis, products on another). On the last worksheet I have a command button. What I want the button to do is populate a new Excel sheet (in a new window) with all of the products – but with 6 months’ worth of data.

So, currently, the table looks like this (for example):

January 1 January 2 January 3 January 4
Product 1

Product 2

Product 3

Product 4

I want the command button to populate a new Excel with a list of the products (Product, 1, Product 2, etc.) but with the next columb of cells having 6 months’ worth of data – which means it will have to add up the columns with the dates (the dates are by day, so it’ll have to add up quite a few columns).

Is this even possible? I have the simple macro below, but it just populates a new excel without any of the data in it.

Sub Newbook12()
MyBook = ActiveWorkbook.Name
Workbooks.Add
ThatBook = ActiveWorkbook.Name
Workbooks(MyBook).Activate
End Sub


An example workbook with your desired outcome (manually produced - or a sample of it at the very least) might help you get a quicker answer here...

JonathanK1

Quote:

Originally Posted by Spencer101 (Post 1607799)
An example workbook with your desired outcome (manually produced - or a sample of it at the very least) might help you get a quicker answer here...

You're right. Sorry about that. I'll try to attach an example to this message.

The dates will go by day all the way to the end of the year (I know, it's a big table but that's the way it has to be). Example one is the example of the table (I didn't go all the way to 365, but you get the gist).

Example two is what I want the newly populated excel to look like - each of the products with all 365 days added up (I alwasy want to do 6 months added up - half - as well in another macro command button).

Does this make sense? The second example is quite basic, but it's the sum in a new spreadsheet...and that's what I'm looking to do. As always, any and all help is appreciated.

Spencer101

Quote:

Originally Posted by JonathanK1 (Post 1607814)
You're right. Sorry about that. I'll try to attach an example to this message.

The dates will go by day all the way to the end of the year (I know, it's a big table but that's the way it has to be). Example one is the example of the table (I didn't go all the way to 365, but you get the gist).

Example two is what I want the newly populated excel to look like - each of the products with all 365 days added up (I alwasy want to do 6 months added up - half - as well in another macro command button).

Does this make sense? The second example is quite basic, but it's the sum in a new spreadsheet...and that's what I'm looking to do. As always, any and all help is appreciated.

There's no attachment...

JonathanK1

Quote:

Originally Posted by Spencer101 (Post 1607818)
There's no attachment...

It won't let me upload the attachment. It says invalid file even though its a simple excel sheet. I switched it to PDF, and it's saying it's too large (it's a simple chart turned into PDF).

No clue.


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com