Create worksheets from Excel list

Closed
Laura - Jun 7, 2011 at 12:10 PM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Jun 7, 2011 at 05:44 PM
Hello,
I've come across the following program to create worksheets from a list in Excel - can someone further explain the steps I need to take to implement this program? I've never done anything like this in Excel before. Also, what I'm looking for is a workbook with a worksheet for each date in it, with the date appearing on the tab and also in the first cell of each tab/worksheet.


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

Set MyRange = Sheets("Summary").Range("A10")
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

1 reply

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Jun 7, 2011 at 12:31 PM
On a sheet, bascially you have to start the values that you want to appear as sheets from Cell A10. It will start processing each value from Cell A10, till the last row. Only catch in this code is that you should have at least value in Cells A10 and A11. The other thing is that there should not be any blank cell in between. Last but not the least is that, the sheet that you are trying to add should not exist before
0
Thanks, but how/where do I put this program information - into a cell?
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Jun 7, 2011 at 05:44 PM
Open excel
Enter the data in the sheet (start from Cell A10, do not leave a11 blank either, and dont leave any blank cell and dont repeat any value. Also ensure that all for all values that you are entering, you do not have a sheet already)

press ALT + F11 at the same time to open vbe
paste the code
press F5 to run the macro
0