ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   tabs by dates (https://www.excelbanter.com/excel-programming/410594-tabs-dates.html)

joemeshuggah

tabs by dates
 
Not sure that this is possible by simply recording a macro. Is there a way
to code this by visual basic?

I have a spreadsheet that has a request date column...I am looking to create
a macro that creates a tab for each year, and then takes the information in
the spreadsheet and breaks it out by tab (e.g taking a workbook with one tab
for years 2003-2008, and making a workbook with six tabs showing information
by year)

joel

tabs by dates
 
You can record a macro and then make simply changes as required.

here is the code for adding the sheets


For MyYear = 2003 To 2008
Set newsht = Sheets.Add(after:=Sheets(Sheets.Count))
newsht.Name = MyYear
'add recorded code here with modification to use newsht
Next MyYear


for MyYear = 2003 to 2008
sheets.add after:=sheets(sheets.count)
activesheet.name = MyYear
next MyYear

"joemeshuggah" wrote:

Not sure that this is possible by simply recording a macro. Is there a way
to code this by visual basic?

I have a spreadsheet that has a request date column...I am looking to create
a macro that creates a tab for each year, and then takes the information in
the spreadsheet and breaks it out by tab (e.g taking a workbook with one tab
for years 2003-2008, and making a workbook with six tabs showing information
by year)


Ken

tabs by dates
 
Joe

Without knowing the format of your data I can't be sure, but, it seems
like this may be something well suited to a pivot table, applying the
Show Pages option.

If the data is suitable to a pivot table you can put the year in the
Page Field, elect to Show Pages, and you will have a sheet for each
year with the data, without a macro or without doing much of anything.

Good luck.

Ken
Norfolk, Va



On May 7, 2:49*pm, Joel wrote:
You can record a macro and then make simply changes as required.

here is the code for adding the sheets

For MyYear = 2003 To 2008
* *Set newsht = Sheets.Add(after:=Sheets(Sheets.Count))
* *newsht.Name = MyYear
* 'add recorded code here with modification to use newsht
Next MyYear

for MyYear = 2003 to 2008
* *sheets.add after:=sheets(sheets.count)
* *activesheet.name = MyYear
next MyYear



"joemeshuggah" wrote:
Not sure that this is possible by simply recording a macro. *Is there a way
to code this by visual basic?


I have a spreadsheet that has a request date column...I am looking to create
a macro that creates a tab for each year, and then takes the information in
the spreadsheet and breaks it out by tab (e.g taking a workbook with one tab
for years 2003-2008, and making a workbook with six tabs showing information
by year)- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 06:11 PM.

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