Macro to autogenerate sheets based on unique values of a list
Closed
Hackdirector
Posts
1
Registration date
Sunday August 16, 2015
Status
Member
Last seen
August 16, 2015
-
Aug 16, 2015 at 09:35 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 18, 2015 at 12:16 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 18, 2015 at 12:16 PM
Related:
- Macro to autogenerate sheets based on unique values of a list
- How to change your best friends list on snapchat to 3 - Guide
- My contacts list names - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Counter strike 1.6 cheats list - Guide
- Sheets right to left - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 18, 2015 at 12:16 PM
Aug 18, 2015 at 12:16 PM
Hi Hack,
The code below will check if the sheet name is already applied. If so then delete the unnamed sheet and continue loop.
Here is the amended code:
Best regards,
Trowa
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.
The code below will check if the sheet name is already applied. If so then delete the unnamed sheet and continue loop.
Here is the amended code:
Sub CreateSheetsFromAList() Dim MyCell, MyRange As Range Dim DeleteSh As Boolean Dim sh As Worksheet Set MyRange = Sheets("SheetA").Range("J12") Set MyRange = Range(MyRange, MyRange.End(xlDown)) For Each MyCell In MyRange Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet For Each sh In Worksheets If sh.Name = MyCell.Value Then DeleteSh = True Next sh If DeleteSh = True Then Application.DisplayAlerts = False ActiveSheet.Delete Application.DisplayAlerts = True Else: Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet End If DeleteSh = False Next MyCell End Sub
Best regards,
Trowa
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.