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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,225,138
Messages
6,183,089
Members
453,147
Latest member
Bree2019

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