names to worksheets from selected cells

Roland Hall

New Member
Joined
Jun 6, 2011
Messages
3
:eeek: Hello everyone,
Can anybody tell me the formula (VBA) to create new worksheets and name them from a list already on a
worksheet...
eg...I have a list of student names that I want to automatically create a series of worksheets with their names on them.
I have tried to do this with a macro, but it does not work.
Please help
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Thank you for replying. I managed to find a VBA formula that worked.
I do have one question-:
How do you combine 2 cells together...for eg a name and surname so that they can be used in a VBA statement like the following-

Sub Addsheets()
Dim LR As Long, i As Long
With Sheets("Sheet2")
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = .Range("A" & i).Value
Next i
End With
End Sub
:confused:

eg... on the active sheet there will be a First Name and a Surname. I want to combine these two, create a space in between(if it is possible) and then use the formula above (except with an active worksheet instead of "Sheet2") to create a whole lot of new worksheets with names on them.
 
Upvote 0
Like this?

Code:
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = .Range("A" & i).Value & " " & .Range("B" & i).Value
 
Upvote 0
I couldnt get that to work. How do you do it...do you put it inside the formula? Do you put it directly in a cell?
How does this work?
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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