Create worksheets from rows with text on Sheet 1 that doesn't the "(" character

rdoulaghsingh

Board Regular
Joined
Feb 14, 2021
Messages
105
Office Version
  1. 365
Platform
  1. Windows
Good afternoon! I have a workbook with a worksheet (Sheet 1). I'm trying to copy the text in all rows starting at A2 to the end of column A without the character "(" in it and create a worksheet for each corresponding text value from each row in Sheet 1. So if A2 has the word "Test" in it, the macro should create a worksheet/tab labeled "Test" as long as the cell doesn't contain an open parenthesis in it. Please help!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Nevermind. Figured it out.


VBA Code:
Sub CreateSheetsfromRows()
 
Dim rng As Range
Dim cell As Range
On Error GoTo Errorhandling
 
Set rng = Application.InputBox(Prompt:="Select cell range:", _
Title:="Create sheets", _
Default:=Selection.Address, Type:=8)
 
For Each cell In rng
 
        If InStr(1, cell.Value, "(") = 0 And cell <> "" Then
  
 
        Sheets.Add(After:=Sheets(Sheets.Count)).Name = cell
    End If
 
Next cell
 
Errorhandling:

 

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

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