Forum Discussion
anupambit1797
Oct 20, 2023Iron Contributor
Multiple-Worksheets creation
Dear Experts, Greetings! I have a case where , in the main sheet I have multiple unique entries in rows and want to create seperate worksheets for each of these rows( say abc, d...
anupambit1797
Iron Contributor
ThanksSergeiBaklan , so if we can replace those [ or ] with "_" and then can we prepare some script to serve the purpose.
Thanks!
Br,
Anupam
peiyezhu
Oct 25, 2023Bronze Contributor
Sub CreateSheetsFromNames()
'Create new sheets from the names added
'to column A beginning at A2 and down.
'Sheets added left-to-right.
Dim cel As Range, rng As Range
Application.ScreenUpdating = False
Set rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
For Each cel In rng
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name =application.WEBSERVICE("http://e.anyoupin.cn/eh3/?regreplace~[\[\]]~_~" & cel.Value)
'regular expression replace once or replace twice
Next cel
Application.ScreenUpdating = True
End Sub
'Create new sheets from the names added
'to column A beginning at A2 and down.
'Sheets added left-to-right.
Dim cel As Range, rng As Range
Application.ScreenUpdating = False
Set rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
For Each cel In rng
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name =application.WEBSERVICE("http://e.anyoupin.cn/eh3/?regreplace~[\[\]]~_~" & cel.Value)
'regular expression replace once or replace twice
Next cel
Application.ScreenUpdating = True
End Sub