You are here:

Excel/Rename sheet based on cell value

Advertisement


Question
Dear Aidan,

I built a workbook help me calculating the bonus for employees.
Master sheet (Master) will have all employees info, separate sheet (emp.)to calculate bonus.
my first issue was: I want excel to automatically create copies of (emp.) sheet equal to number of employees in Master sheet and each new sheet to get one employee name, that will give a separate calculation sheet for each employee.
the second issue: the result of each (emp.) sheet to transfer to the Master sheet again in one column called (Bonus) for each employee.

think this will require VBA, but I don't know from where I should start
kindly advise.

Thanks & Regards

Answer
This VBA

Dim mysht As Worksheet
Set mysht = Worksheets("Master")
Dim n As Long
n = 1
While Len(mysht.Cells(n, 1).Value) > 0
   Worksheets("Emp").Copy After:=Worksheets("Master")
   
   ActiveSheet.Name = mysht.Cells(n, 1).Value
   n = n + 1
Wend


will work to create the sheets - it assumes the employee names are in column A starting at row one - amend my cells(n,1) to whichever column you want and set the starting value of n to whichever row you want.

I'm not clear what you want the summary to do - if this is a member by member summary then probably the indirect worksheet function would do the job without using vba?
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Aidan Heritage

Expertise

I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!

Experience

My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

Education/Credentials
I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2016 About.com. All rights reserved.