Macro to create worksheets base on name

  • Thread starter Thread starter unplugs
  • Start date Start date
U

unplugs

I have 2 workbooks.
Name:Database workbook and Employee workbook.

FOr the Database workbook, I got 30 worksheets in it which I define th
range, and I give the worksheet name for each of the 30 employees.

when I open the Employee worksheet, the particular data for eac
employees from the Database workbook will be copy over to employe
workbook. Employee will make their entries there, then save it. Th
data that save will then copy and paste to the particular worksheets i
the Database workbook.

This work great for me! Anyway, my boss ask me to do it more easily s
that they can add/ delete employees in the Database workbook easier.

How can I do such that, when I key in employee name, and click on "ADD
button in userform, it will create a new worksheet which th
worksheet's name is the Employee name? After create the worksheet,
would like the macro to define the range for the worksheets(So that
can copy & Paste using this range).

How to do this using code?

Hoping for someone to shed the light for me.

THanks in advance
 
this should hopefully get you started:

Sub InsertNewSheetAndName()

Dim SheetName As String

SheetName = InputBox("Please Enter New Worksheet Name:")
Sheets.Add
ActiveSheet.Name = SheetName

End Sub

Cheers,
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top