PC Review


Reply
Thread Tools Rate Thread

Create Sheets from a Range and Copy Data on copy Data on newlycreated Sheets with the Sheet Names

 
 
prkhan56
Guest
Posts: n/a
 
      7th Feb 2012
Hello,
I am using Excel 2010.

I got this macro which makes new sheets according to the Names on the
Summary Sheet.

Sub CreateSheetsFromAList()
Dim MyCell As Range, MyRange As Range

Set MyRange = Sheets("Summary").Range("A2")
Set MyRange = Range(MyRange, MyRange.End(xlDown))

For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
Next MyCell
End Sub

I also wish to achieve following with the macro.
1) It should copy the Data from Sheet1 (A2:H12) on all the newly
created sheets in the Range B2:I2 on each sheet.
2) The name of each Sheet should appear in Cell B1 on all sheets and
also in the range A2:A12 on all the sheets creates.

Thanks in advance
R Khan
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      7th Feb 2012
Should work in version xl2003 and later

Sub CreateSheetsFromAList()
Dim MyCell As Range
Dim MyRange As Range

Set MyRange = Sheets("Summary").Range("A2")
Set MyRange = Range(MyRange, MyRange.End(xlDown))

For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
With ActiveSheet
.Name = MyCell
Sheets("sheet1").Range("a2:h12").Copy .Range("b2")
.Range("a2:a12,b1") = MyCell
End With
Next MyCell
End Sub


On Feb 7, 12:44*am, prkhan56 <prkha...@gmail.com> wrote:
> Hello,
> I am using Excel 2010.
>
> I got this macro which makes new sheets according to the Names on the
> Summary Sheet.
>
> Sub CreateSheetsFromAList()
> Dim MyCell As Range, MyRange As Range
>
> Set MyRange = Sheets("Summary").Range("A2")
> Set MyRange = Range(MyRange, MyRange.End(xlDown))
>
> For Each MyCell In MyRange
> Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
> Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
> Next MyCell
> End Sub
>
> I also wish to achieve following with the macro.
> 1) It should copy the Data from Sheet1 (A2:H12) on all the newly
> created sheets in the Range B2:I2 on each sheet.
> *2) The name of each Sheet should appear in Cell B1 on all sheets and
> also in the range A2:A12 on all the sheets creates.
>
> Thanks in advance
> R Khan


 
Reply With Quote
 
prkhan56
Guest
Posts: n/a
 
      7th Feb 2012
On Feb 7, 7:27*pm, Don Guillett <dguille...@gmail.com> wrote:
> Should work in version xl2003 and later
>
> Sub CreateSheetsFromAList()
> Dim MyCell As Range
> Dim MyRange As Range
>
> Set MyRange = Sheets("Summary").Range("A2")
> Set MyRange = Range(MyRange, MyRange.End(xlDown))
>
> For Each MyCell In MyRange
> Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
> With ActiveSheet
> *.Name = MyCell
> * Sheets("sheet1").Range("a2:h12").Copy .Range("b2")
> *.Range("a2:a12,b1") = MyCell
> End With
> Next MyCell
> End Sub
>
> On Feb 7, 12:44*am, prkhan56 <prkha...@gmail.com> wrote:
>
>
>
> > Hello,
> > I am using Excel 2010.

>
> > I got this macro which makes new sheets according to the Names on the
> > Summary Sheet.

>
> > Sub CreateSheetsFromAList()
> > Dim MyCell As Range, MyRange As Range

>
> > Set MyRange = Sheets("Summary").Range("A2")
> > Set MyRange = Range(MyRange, MyRange.End(xlDown))

>
> > For Each MyCell In MyRange
> > Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
> > Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet
> > Next MyCell
> > End Sub

>
> > I also wish to achieve following with the macro.
> > 1) It should copy the Data from Sheet1 (A2:H12) on all the newly
> > created sheets in the Range B2:I2 on each sheet.
> > *2) The name of each Sheet should appear in Cell B1 on all sheets and
> > also in the range A2:A12 on all the sheets creates.

>
> > Thanks in advance
> > R Khan- Hide quoted text -

>
> - Show quoted text -


Works like a charm! You are a great help...always.
Thanks a lot
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:24 PM.