Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default copy sheet1 and name sheets using names from a range

I want to modify this macro so that it copies sheet1, the appropriate number
of times.
At present it adds new blank sheets.

Sub CopySheet1()
Dim arr As Variant
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Set NewSheet = Sheets.addd
NewSheet.Name = arr(i, 1)
Next i

End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default copy sheet1 and name sheets using names from a range

Hi,

Sub CopySheet1()
Dim arr As Variant
Dim newsheet As Worksheet
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Worksheets("Sheet1").Copy after:=Worksheets("Sheet1")
Set newsheet = ActiveSheet
NewSheet.Name = arr(i, 1)
Next i
End Sub

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
I want to modify this macro so that it copies sheet1, the

appropriate number
of times.
At present it adds new blank sheets.

Sub CopySheet1()
Dim arr As Variant
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Set NewSheet = Sheets.addd
NewSheet.Name = arr(i, 1)
Next i

End Sub



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default copy sheet1 and name sheets using names from a range

Hi Jan,

Thank you for your help.

That works wonderfully well.


--
Regards,
David Lindstrom

"Jan Karel Pieterse" wrote in message
...
Hi,

Sub CopySheet1()
Dim arr As Variant
Dim newsheet As Worksheet
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Worksheets("Sheet1").Copy after:=Worksheets("Sheet1")
Set newsheet = ActiveSheet
NewSheet.Name = arr(i, 1)
Next i
End Sub

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
I want to modify this macro so that it copies sheet1, the

appropriate number
of times.
At present it adds new blank sheets.

Sub CopySheet1()
Dim arr As Variant
arr = Range("i1:i44").Value
For i = LBound(arr) To UBound(arr)
Set NewSheet = Sheets.addd
NewSheet.Name = arr(i, 1)
Next i

End Sub



.



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
Data in sheet1 to be put into sheets 2, 3, 4, 5, etc Cord Excel Discussion (Misc queries) 2 December 18th 09 10:19 AM
VBA Code Required for deleting All Sheets except Sheet1 Ms-Exl-Learner Excel Discussion (Misc queries) 7 November 3rd 09 10:19 AM
Match Names in columns then copy associated info from 2 sheets Seantastic Excel Worksheet Functions 4 October 29th 08 08:29 PM
Sheets named from range, and copy data? [email protected] Excel Discussion (Misc queries) 4 January 12th 07 02:53 PM
How do I set up a workbook so changing Sheet1 changes all sheets? rach1027 Excel Worksheet Functions 1 June 7th 05 10:12 AM


All times are GMT +1. The time now is 11:04 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"