Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default worksheet tabs

i have several workbooks with multi tabs in them. how can i generate a
workbook for each tab via vb code?

the number of tabs varies per workbook. is there a way to loop thru total
entries and as each tab is evaluated to generate a workbook whereby tab 1
generates the name stdbook1, tab 2 generates the name stdbook2 and so forth

thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default worksheet tabs

Your description is a bit thin but this should be close to what you want...

Sub stuff()
Dim wks As Worksheet
Dim wbkNew As Workbook
Dim lng As Long

lng = 1
For Each wks In ThisWorkbook.Worksheets
wks.Copy
Set wbkNew = ActiveWorkbook
wbkNew.SaveAs ThisWorkbook.Path & "\stdBook" & lng & ".xls"
wbknew.close
lng = lng + 1
Next wks

End Sub
--
HTH...

Jim Thomlinson


"jnewl" wrote:

i have several workbooks with multi tabs in them. how can i generate a
workbook for each tab via vb code?

the number of tabs varies per workbook. is there a way to loop thru total
entries and as each tab is evaluated to generate a workbook whereby tab 1
generates the name stdbook1, tab 2 generates the name stdbook2 and so forth

thanks for your help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default worksheet tabs

how do i specify the path?

tried something like this, but did not work
Sub buildbook()
Dim wks As Worksheet
Dim wbknew As Workbook
Dim lng As Long
Dim path As String
lng = 1
For Each wks In ThisWorkbook.Worksheets
wks.Copy
Set wbknew = ActiveWorkbook
path = "H:\hsrstaff\Implementation and MOB\fee sched cons - IT data\SR for
provider listings\topps provider listings from Srs"
wbknew.SaveAs ThisWorkbook.path & "\stdbook" & lng & ".xls"
wbknew.Close
lng = lng + 1
Next wks


thanks

"Jim Thomlinson" wrote:

Your description is a bit thin but this should be close to what you want...

Sub stuff()
Dim wks As Worksheet
Dim wbkNew As Workbook
Dim lng As Long

lng = 1
For Each wks In ThisWorkbook.Worksheets
wks.Copy
Set wbkNew = ActiveWorkbook
wbkNew.SaveAs ThisWorkbook.Path & "\stdBook" & lng & ".xls"
wbknew.close
lng = lng + 1
Next wks

End Sub
--
HTH...

Jim Thomlinson


"jnewl" wrote:

i have several workbooks with multi tabs in them. how can i generate a
workbook for each tab via vb code?

the number of tabs varies per workbook. is there a way to loop thru total
entries and as each tab is evaluated to generate a workbook whereby tab 1
generates the name stdbook1, tab 2 generates the name stdbook2 and so forth

thanks for your help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to name worksheet tabs using a cell within the worksheet? Jennifer Excel Discussion (Misc queries) 4 November 6th 12 05:03 PM
Worksheet Tabs two_tone Excel Worksheet Functions 2 May 29th 09 03:03 AM
Copy data in multiple worksheet tabs into one worksheet Bob Excel Programming 2 February 15th 08 03:01 PM
Can Excel worksheet tabs be relocated above the worksheet? BCWB Excel Discussion (Misc queries) 1 November 1st 06 09:14 PM
Worksheet Tabs Donald Lloyd Excel Programming 5 August 4th 03 04:15 AM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"