ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to create worksheets base on name (https://www.excelbanter.com/excel-programming/303794-macro-create-worksheets-base-name.html)

unplugs[_47_]

Macro to create worksheets base on name
 
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

--
Message posted from http://www.ExcelForum.com


al

Macro to create worksheets base on name
 
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

"unplugs " wrote:

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

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

when I open the Employee worksheet, the particular data for each
employees from the Database workbook will be copy over to employee
workbook. Employee will make their entries there, then save it. The
data that save will then copy and paste to the particular worksheets in
the Database workbook.

This work great for me! Anyway, my boss ask me to do it more easily so
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 the
worksheet's name is the Employee name? After create the worksheet, I
would like the macro to define the range for the worksheets(So that I
can copy & Paste using this range).

How to do this using code?

Hoping for someone to shed the light for me.

THanks in advance.


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com