ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create New Wk (https://www.excelbanter.com/excel-programming/365800-create-new-wk.html)

halem2[_71_]

Create New Wk
 

Hi folks:

I have an Excel file with a list of 150 names or more, one name per
cell in column A. This list changes weekly. I need to create a
workbook with using those names one name per worksheet, meaning each
tab name in the new workbook would be the list.

Any thoughts?

thanks in advance :confused: :)


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=556892


Piotr Lipski

Create New Wk
 
On Thu, 29 Jun 2006 08:38:36 -0500, halem2 wrote:

Hi folks:

I have an Excel file with a list of 150 names or more, one name per
cell in column A. This list changes weekly. I need to create a
workbook with using those names one name per worksheet, meaning each
tab name in the new workbook would be the list.

Any thoughts?

thanks in advance :confused: :)


Sub GenerateWB()
Dim rng As Excel.Range
Dim wkb As Excel.Workbook
Workbooks.Add
Set wkb = ActiveWorkbook
Set rng = Me.Range("A1")
Do While rng.Value < ""
wkb.Sheets.Add
wkb.ActiveSheet.Name = rng.Value
Set rng = rng.Offset(1, 0)
Loop
End Sub

--
PL

halem2[_72_]

Create New Wk
 

thanks. I'm getting en error pointing to invalid use of ME.


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=556892


Piotr Lipski

Create New Wk
 
On Thu, 29 Jun 2006 09:18:15 -0500, halem2 wrote:

thanks. I'm getting en error pointing to invalid use of ME.


This code works fine if you put in into a worksheet module. If you want to
use it as a separate module, use ThisWorkbook.Sheets("sheetname") instead
of Me

--
PL

halem2[_74_]

Create New Wk
 

thanks a lot. I was able to ncorporate your code into my project.
Thanks again.


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=556892



All times are GMT +1. The time now is 10:05 PM.

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