Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 52
Default Creating worksheets with cell values as names

Hello

From a group of cells in a worksheet I want to create
worksheets in the same workbook, each of which has the
name of the contents of the cells (all strings).

for example:
value in cell A1 is 'Ball Valve'
valve in cell A2 is 'Globe Valve'

I want to create 2 worksheets: one named 'Ball Valve', the
other 'Globe Valve'.

The number of cells will vary as will the values. The
group will always start in cell A1.

I can add 2 worksheets, but they have the generic
names 'Sheet2' etc.

What is the best way of creating the worksheets and
renaming them?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Creating worksheets with cell values as names

Hi Bob,

With your names listed in column A , starting in A2 (to allow for a header),
try:

Sub AddSheets()
Dim LastCell As Range, Rng As Range, Cell As Range
Dim WS As Worksheet
Set WS = ActiveSheet
Set LastCell = WS.Cells(Rows.Count, "A").End(xlUp)
Set Rng = WS.Range("A1", LastCell)
For Each Cell In Rng
If Not IsEmpty(Cell) Then
Sheets.Add.Name = Cell.Value
End If
Next

End Sub



---
Regards,
Norman


"Bob" wrote in message
...
Hello

From a group of cells in a worksheet I want to create
worksheets in the same workbook, each of which has the
name of the contents of the cells (all strings).

for example:
value in cell A1 is 'Ball Valve'
valve in cell A2 is 'Globe Valve'

I want to create 2 worksheets: one named 'Ball Valve', the
other 'Globe Valve'.

The number of cells will vary as will the values. The
group will always start in cell A1.

I can add 2 worksheets, but they have the generic
names 'Sheet2' etc.

What is the best way of creating the worksheets and
renaming them?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Creating worksheets with cell values as names

Hi Bob,

Forgot to change:

Set Rng = WS.Range("A1", LastCell)

to

Set Rng = WS.Range("A2", LastCell)


to allow for the mentioned header!


---
Regards,
Norman


"Norman Jones" wrote in message
...
Hi Bob,

With your names listed in column A , starting in A2 (to allow for a

header),
try:

Sub AddSheets()
Dim LastCell As Range, Rng As Range, Cell As Range
Dim WS As Worksheet
Set WS = ActiveSheet
Set LastCell = WS.Cells(Rows.Count, "A").End(xlUp)
Set Rng = WS.Range("A1", LastCell)
For Each Cell In Rng
If Not IsEmpty(Cell) Then
Sheets.Add.Name = Cell.Value
End If
Next

End Sub



---
Regards,
Norman


"Bob" wrote in message
...
Hello

From a group of cells in a worksheet I want to create
worksheets in the same workbook, each of which has the
name of the contents of the cells (all strings).

for example:
value in cell A1 is 'Ball Valve'
valve in cell A2 is 'Globe Valve'

I want to create 2 worksheets: one named 'Ball Valve', the
other 'Globe Valve'.

The number of cells will vary as will the values. The
group will always start in cell A1.

I can add 2 worksheets, but they have the generic
names 'Sheet2' etc.

What is the best way of creating the worksheets and
renaming them?







  #4   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 52
Default Creating worksheets with cell values as names

Thanks Norman.
-----Original Message-----
Hi Bob,

Forgot to change:

Set Rng = WS.Range("A1", LastCell)

to

Set Rng = WS.Range("A2", LastCell)


to allow for the mentioned header!


---
Regards,
Norman


"Norman Jones" wrote in

message
...
Hi Bob,

With your names listed in column A , starting in A2 (to

allow for a
header),
try:

Sub AddSheets()
Dim LastCell As Range, Rng As Range, Cell As Range
Dim WS As Worksheet
Set WS = ActiveSheet
Set LastCell = WS.Cells(Rows.Count, "A").End(xlUp)
Set Rng = WS.Range("A1", LastCell)
For Each Cell In Rng
If Not IsEmpty(Cell) Then
Sheets.Add.Name = Cell.Value
End If
Next

End Sub



---
Regards,
Norman


"Bob" wrote in

message
...
Hello

From a group of cells in a worksheet I want to create
worksheets in the same workbook, each of which has the
name of the contents of the cells (all strings).

for example:
value in cell A1 is 'Ball Valve'
valve in cell A2 is 'Globe Valve'

I want to create 2 worksheets: one named 'Ball

Valve', the
other 'Globe Valve'.

The number of cells will vary as will the values. The
group will always start in cell A1.

I can add 2 worksheets, but they have the generic
names 'Sheet2' etc.

What is the best way of creating the worksheets and
renaming them?







.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Creating worksheets with cell values as names


There's no logic in what you're saying..
A1= Ball
A2= Globe

How does that tally with: the group always starts in a1 ??
I assume you DONT want to create a sheet for each CELL in a range?

Please try to rephase it in such a way that there's some logical flow
that a programmer can put into code ?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob wrote :

Hello

From a group of cells in a worksheet I want to create
worksheets in the same workbook, each of which has the
name of the contents of the cells (all strings).

for example:
value in cell A1 is 'Ball Valve'
valve in cell A2 is 'Globe Valve'

I want to create 2 worksheets: one named 'Ball Valve', the
other 'Globe Valve'.

The number of cells will vary as will the values. The
group will always start in cell A1.

I can add 2 worksheets, but they have the generic
names 'Sheet2' etc.

What is the best way of creating the worksheets and
renaming them?




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
Using cell names across multiple worksheets M.Boone Excel Discussion (Misc queries) 4 October 8th 09 03:42 PM
Tab Names to Match Cell Values when Changed Johnny Excel Discussion (Misc queries) 8 August 20th 09 09:19 PM
Creating cell names from cell contents en masse John[_26_] Excel Worksheet Functions 1 May 15th 09 02:41 AM
tab names from cell values cursednomore Excel Discussion (Misc queries) 5 January 3rd 07 07:24 PM
apply cell names to formulas in multiple worksheets BBurrows Excel Worksheet Functions 4 July 1st 05 05:35 PM


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

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

About Us

"It's about Microsoft Excel"