VBA - create new sheets from a dynamic list

2019gibsonSG

New Member
Joined
Mar 28, 2022
Messages
1
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I have a worksheet named "RawInt" that looks like this:

1648484804419-png.61096


I need code for a macro that starts at cell BO6 and goes down the column creating a new sheet for each cell value. The data in column BO always begins at BO6, but number of records in column BO change from project to project so the code would have to stop once an empty cell is detected. The sheets would need to be added after sheet "RawInt", in the same order as the data in column BO.

I've done some googling and tried code from several different sources but everything I've tried either doesn't run, doesn't apply to the structure of my data, or runs so slowly that Excel freezes and I have to force quit. Help is greatly appreciated.
 

Attachments

  • 1648484804419.png
    1648484804419.png
    92.5 KB · Views: 167

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this:
VBA Code:
Sub Make_New_Sheets()
'Modified  3/28/2022  9:01:04 PM  EDT
On Error GoTo M
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Sheets("RawInt").Cells(Rows.Count, "BO").End(xlUp).Row
    For i = Lastrow To 6 Step -1
        Sheets.Add(After:=Sheets("RawInt")).Name = Sheets("RawInt").Cells(i, "BO").Value
    Next
Application.ScreenUpdating = True
Exit Sub
M:
MsgBox "We had a problem" & vbNewLine & "You may be using a improper sheet name"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top