Macro: Create & Name New Worksheets

Sep 30, 2008

I have a workbook that is tracking part-time faculty appointments. Names and appointment details are entered on the first worksheet ("Entry"). I have another worksheet that pulls data from Entry to generate a summary of the salary for each appointment. Right now, this worksheet is called "Template" that needs to be copied and renamed for each appointment entered.

So, Entry could have up to 56 columns of data entered. There are nearly 100 rows of information for each entry (portrait-style for ease of printing). Columns A and B are information and will not have any entries. Column C is the starting point for the entry of appointments. Cell C5 will have the first appointment Name.

What I want is to create a macro that will copy the Template worksheet as many times as there are names entered from C5 and beyond (D5, E5, F5, etc.) When it creates each new worksheet, I want it to rename the new worksheet with the contents of row 5. For example, if "Smith, J." (without the quotes) is entered in C5, I want a copy of the worksheet Template called Smith, J.

The renaming of the sheet is important because I have a cell in Template that pulls the worksheet name, which is then referenced by cells in Template to pull the information pertaining to that appointment.

What I have seen here on Mr.Excel is a macro to rename a worksheet based on a specified cell, and I've seen something that looks like it created new worksheets, but I haven't seen the two put together like I'm looking for. I am also not that adept at the VBA, so I haven't really been able to figure out how to cobble it together myself.

To summarize:
- I have two worksheets: Entry and Template
- Names are entered into cells (C5, D5, E5, F5, etc.) on Entry
- I need to copy Template as many times as Names are entered and rename each new copy with that Name (also, new sheets should be generated at the end (right) of the current list of worksheets)
- The whole process can be activated by a button on Entry

View 9 Replies


ADVERTISEMENT

Create Macro To Rename Worksheets In Other Folders

Dec 23, 2008

I have created an appointment schedule spreadsheet. Once I get the spreadsheet running smoothly, I would like to create a worksheet for every day of the year that we are open.

I have decided to have one main folder with 26 subfolders in it. In each of those 26 subfolders, there will be one workbook with 12 worksheets in it. That will be two weeks worth of appointments as we are open Mon-Sat. Of course I want to name the worksheet tabs at the bottom of the workbook according to the appropriate calendar date. Then there is also a cell at the top of each page that also has the date, the same as the date on the tab. Just wondering if there is a simple way to create a macro to rename all these worksheet tabs, or if I have to physically open up each workbook, and rename all the worksheet tabs according to the calendar date. Then once the worksheet tab is named, can you make it automatically put the same date into Cell A1?

View 9 Replies View Related

Create Macro To Hyperlink Cells To Certain Worksheets?

Apr 4, 2014

I want the macro to:

1. Create a new worksheet when data is entered into a cell (ie. entered text "ACC2013" into cell A5)

2. Rename that worksheet to correspond to the data in the cell (ie. change worksheet name from sheet2 to "ACC2013")

3. Create a hyperlink between cell A5 and sheet2

I'd like for this macro to loop through a range of cells so I don't have to have a long code. Let's say my data range is from A5:A23. If this requires multiple macros that is fine.

View 1 Replies View Related

Macro To Create Worksheet 'xxxx' And List All Worksheets In Workbook

Feb 2, 2009

I am after some code to create a new worksheet called 'xxxx' in my workbook, and then list all the sheets within the workbook (excluding the newly created 'xxxx' sheet.)

View 4 Replies View Related

Error Handling Within Errors (macro To Create New Worksheets In The Workbook)

Aug 12, 2009

I am currently creating a database which involves using a macro to create new worksheets in the workbook. When the macro is run and a work sheet is being inserted, an input box asks the user for a worksheet name.

As you can imagine, the worksheet does not like it when the worksheet name input by the user, is the same as one already existing and so throws up a 1004 error.

In order to resolve this error I have included an error handling code to request the user to input a differnet worksheet name, as the one previously inserted exists.

My problem: It all works fine until the user types in an existing worksheet name twice, so once initially and again when the error handler has prompted a second attempt. On the second incorrect input a 1004 error warning is displayed.

I would like the error handler to keep repeating until a worksheet name that doesn't exist is inserted by the user. Is this possible?

My code so far:

Sub NewTrancheSheet()
'
Sheets("Tranche Sheet Template").Visible = True
Sheets("Tranche Sheet Template").Select

Sheets("Tranche Sheet Template").Copy Before:=Sheets(1)

Sheets("Tranche Sheet Template (2)").Select
Sheets("Tranche Sheet Template (2)").Move After:=Sheets(Sheets.Count)
Sheets("Tranche Sheet Template (2)").Select.................

View 9 Replies View Related

Excel 2007 :: Macro Or Formula To Create Summary Of Data In Various Worksheets

May 5, 2014

I'm trying to update a the summary sheet that will run through the 10 worksheets and bring back the entire row (or the columns I specify) that matches the creteria MS.

MS will appear against each row in the same column in all the tabs.

So in the summary sheet I would see all the rows individually that appear in tabs 1-10.

Excel 2007.

View 9 Replies View Related

How To Create Search Macro Button That Allows To Search In Multiple Worksheets In One Workbook

Oct 11, 2011

Im am trying to create a search marco button that allows me to search in multiple worksheets in one work book. I came across this CODE the first part of it works. It pops open user input box and ask for the word that i would like to search but the this error message pops up Runtime error1004 Method 'range" of object'_Global'failed and i dont know what to do

Private Sub SearchButton_Click()
SearchString = InputBox("Enter Search String", "Search")
If SearchString = "" Then Exit Sub
For Each c In Range(myRange)
If InStr(LCase(CStr(c)), LCase(SearchString)) Then

[Code]....

View 1 Replies View Related

Excel 2010 :: Create Macro Button To Clear Multiple Cells On Multiple Worksheets?

Jul 2, 2014

I have attached a test workbook excel 2010 (ignore ref# errors, I've cut the workbook down for uploading purposes) What I would like to do is have a 'Button' on my 'information Sheet' which when clicked would clear certain cells. I have searched the forum but can't find a solution, everyone seems to want to delete rows or columns but I just want to clear certain cells. The workbook will have 11 sheets each named 'caravan 1' through to 'caravan 11' The uploaded test workbook only only has 3 sheets.

On 'caravan 1' (which is slightly different to the other 10) I want to clear the content of cells

B4 & B5
C4, C22 & C41
D4 & D5
E4,E5, E22,E23,E41 &E 42

On all other 'Caravan sheets' I want to clear the contents of cells

D4 & D5
E4, E5, E22, E23, E41 & E42

It would be icing on the cake if it could give a warning such as " are you sure you want to clear these cells" but that isn't really necessary. The worksheets will be password protected, but the cells mentioned above will not be. If it proves too difficult to clear all the cells on all the sheets with one click, then perhaps a simpler solution might be to have a button on each sheet instead

View 8 Replies View Related

Create Macro That Can Create Dynamic Copy / Paste Loop?

Feb 12, 2014

I need to create a macro that can create a dynamic copy/paste loop. So far what I have is horribly inefficient. Each row in colmn A(minus the header) has a unique number in it. For each unique number, I need to paste it based on the number of column headers in row 1(minus column A). So, if there are 20 column headers, I need to copy cell A2 and paste it 19 times in another sheet. Then, I need to move to the next number in column A and do the same thing. Here's what I have:

[Code] .........

You can see that this is not dynamic. If I add another row to my table and rerun the macro, it will not catch it. I've attached a sample file to show you the big picture of what I'm trying to do. The data that I have is in Sheet1, and I'm trying to get it into the format in Sheet3. Rows/columns will be periodically added to the table in Sheet1, so the macro needs to be dynamic to catch that. The data in Sheet3 will always remain, and the macro will add the updated data below the old data in Sheet3.

FC_Macro_Sample.xlsm

View 8 Replies View Related

How To Create Overall Graph From Multiple Worksheets

Jun 28, 2006

I am wanting to create a yearly graph, but it isn't allowing me to add cells from multiple worksheets.

View 1 Replies View Related

Loop To Create New Worksheets, Name Them And Add Web Query

Jul 10, 2009

I have been trying to create new worksheets, name them and create webquery according to the input on table B4:C13 in test1 sheet attached (code is in module 1). After I run the code it stops after creating sheet with name 1 and shows error 1004. here it is the

View 8 Replies View Related

Create Couple Of New Worksheets With Existing One

Jul 7, 2014

I want to create 4 quarter sheets at the same time, but my code could only process 1 quarter sheet each time. Also, I have trouble of copying and pasting the values from yearsheet to the quarter sheets. ( see attachment document )

View 5 Replies View Related

Create Search Within Excel Worksheets

Jul 22, 2014

Attached is my excel worksheet I have created for a tracking/billing system for numerous schools. How I can create a search form?

For example, I want to find all of the kids in 5th grade that had to be referred throughout the whole document. Or I want to find a certain name to see if they have been paid but I do not know the location.

SmilesStats.xlsm

View 7 Replies View Related

Loop Functions To Create Worksheets

Apr 1, 2009

I've got a data set (words and text) where in column J the number 100 appears at random intervals. Each time the number 100appears, i want to take all data from cell A:J and copy that data to a new worksheet and then name it with the word in cell A.

View 7 Replies View Related

Excel VBA To Create New Workbook And Name Worksheets Within

Nov 15, 2011

Code that will autofilter my sheet for rows that contain either a 1,2,3, or 4 in Column "Z". Then, create a new workbook for each unique value in column "O" and save that to a folder on my desktop named "Contracts". Next, while still filtered by by "Z" and for every unique value in column "O", filter and name a sheet in the new workbook for each unique value in column "B". Finally, while the main sheet is filtered I need to copy and paste the visible cells (minus header row) from columns C,D,E,F,G,H,S, and U to consecutive columns in the newly created worksheet beginning in cell "A9".

I am using excel to create some contracts for a few partners. Each partner could work with several of my clients and I need to give each partner a personalized contract for each of my clients with which they work.

I hope my description of the problem is not too confusing. If so, let me know and I will try to clarify exactly what I am trying to say.

I have tried to combine some code that I already have but, being a newb with loops, I can't seem to get it to do everything.

View 1 Replies View Related

Create A Loop To Add Multiple Worksheets

Jan 27, 2012

I am trying to create a loop to add multiple worksheets

I want to add a new sheet for each company (A2:A14)

I am also wanting to add the sheets after the current last sheet if possible.

Sub addnewsheet()
x = 2
Do Until Cells(x, 1) ""
Sheets.Add.Name = Worksheets("securities").Cells(x, 1).Value & ".ax"
x = x + 1
Loop
End Sub

View 3 Replies View Related

Loop Through One Worksheet And Create New Worksheets

Mar 1, 2012

I am trying to do payslips. Basically I have one worksheet with about 7 columns. I have a 2nd worksheet that is like a template payslip.Worksheet 1 has hours worked and pay etc.

I want to find a method to loop through worksheet 1 and using worksheet 2 as a template create more worksheets and have the values come from worksheet 1 in the new worksheets.

View 2 Replies View Related

Create Separate Worksheets Within Workbook

Oct 28, 2008

I have a table of data with three columns. In the first column I have different values, but they can also repeat. How can I have VB look at my table and for every distinct value in the first column create a sheet with the value name and paste all the data into that same sheet?

View 9 Replies View Related

Modify Code To Create Worksheets

Dec 12, 2008

I have this code that will create 3 worksheets with the name "New Name" and the # ( 1/2/3 ) ..

How would I change the code if I want 3 worksheets with different name?
Like Sheet1 then Sheet 2 then Sheet3 or any other name?

'To add worksheets and change name with one code
For i = 1 To 3 'Creates 3 worksheets
Set ws = Worksheets.Add
ws.Name = "New Name" & i
Next i

View 9 Replies View Related

Create New Worksheets From Button/link

Jan 17, 2007

on a workbook I use.

The workbook (26-11GL.xls) contains a varying number of sheets.
Sheet 1 - Menu
Sheet 2 - DS1
Sheet 3 -DS2
Sheet 4 -DS3
Sheet 5 - DS4
Sheet 6 - Company1
Sheet 7 - Company2
Sheet 8 - Company3
Sheet 9 ....14 Company 4,5 etc
Sheet 15 - CompanyTotals

What I would like to do is when I open the workbook on the Menu page I would like to have some links / buttons that will automatically create a new worksheet called DS5 which has all the formatting, formulas etc from DS4 (or the last complete DS sheet)
If this is possible I would like to be able to add Company worksheets as both DS sheets and company sheets can have from 3 to 35 sheets in either area.

If possible I would like the new DS sheets to be named with the next valid number.

View 6 Replies View Related

Create Click-able Links To Worksheets

Sep 13, 2007

I am interested in finding out how to link worksheets. For example: the bottom tabs for worksheet1 says contacts. tab for worksheet2 says projects. I want to link from worksheet1 to worksheet2 by clicking on a link that will take the person to the project. On worksheet 2 I have more than one project. THerefore, on worksheet1 after all the content I'd like to have a link that says Project 1 with a link that sends the person to the next worksheet. Same with Project 2. I know this is possible. I have already added the formula. Now I need information on how to insert a link that can be clicked on that will go to the next page.

View 4 Replies View Related

Create Master Sheet From Several Worksheets Using Criteria?

May 24, 2013

This code does creates a Master Sheet for all the worksheets in the workbook.

VB:
Sub CreateMaster()
Dim wrk As Workbook 'Workbook object - Always good to work with object variables
Dim sht As Worksheet 'Object for handling worksheets in loop

[Code].....

I will run this code monthly thru a button to be created on the 1st worksheet.

VBA for the Master worksheet to be created in another workbook? So One code for the Master to be created on the active workbook and another to a different workbook.

View 9 Replies View Related

Create New Document On Button Click Containing Worksheets?

Aug 7, 2013

I have five worksheets among eight total in my workbook that I use as a report. I would like to have a button that copies those five particular worksheets into a new workbook and pastes all numbers as un-linked values. This would save me a TREMENDOUS amount of time generating my reports every month.

View 3 Replies View Related

Using Command Button To Create PDF - Unprotect Worksheets

Dec 5, 2012

I have an excel that has Marco being run by using a command button to create my pdf's. But my work sheets are Protected by a password. Is there a code for me to insert in order for the worksheet become unprotected for it to do the commands I am requesting?

View 5 Replies View Related

Using Autofilter Values To Create New Worksheets Or Workbooks

May 13, 2014

I often have a table (sometimes formatted as a table, sometimes just data arranged like a table but not formatted as a table in Excel) where I'd like to create individual worksheets (eventually workbooks) based on the information in one of the columns. Take for instance the attached file. I'd like to create a macro to create worksheets (or preferably workbooks) based on data in the Region column. So workbook 1 would be something like North Region Sales 2014, and contain only the data for the North region. Workbook 2 would be something like South Region Sales 2014, and contain only the data for the South region, and so on. Sometimes I might need to create these based off the Region field, another time I might need to do it based off of the Salesperson.

Region Sales 2014.xlsx

To do this currently, I'd use the filter and unselect whichever data I want to keep and then delete all the remaining (visible) rows. When I unfilter, I'm only left with the data I want. This works, but it takes a long time when working with 50 or more "Regions" and large amounts of data.

View 14 Replies View Related

Parse Worksheet, Create Multiple Worksheets

Jul 20, 2009

I have a single worksheet containing data in columns A-J. I need to Copy all cells to a new work sheet when the value in column A changes. The worksheet should be named the value of column A. I have found thread 656226, but am unable to modify to work.

View 8 Replies View Related

Create New Worksheets Based On Range On Other Worksheet

Dec 21, 2011

I have file contains two worksheets. 1st worksheet named "list" and the 2nd one named "Template". I have a range in WS "List" let say a1:d20 that contains names. This range is not fix, it might be more or less. I need creating new worksheet using worksheet "Template" for the new sheets in the mentioned range as follow:

"Create new worksheet for each name in this range."

List is not unique, some names are duplicated. If the name repeated, create only one. Use worksheet template for each new worksheet created.

View 2 Replies View Related

Loop Range To Create New Worksheets Named For Each Row?

Jan 6, 2014

i have a range of rows that change (could be 10-100) how do i loop the range to create new worksheets named for each row?

View 3 Replies View Related

Copy Column From All Worksheets & Create 1 List

Oct 30, 2006

I have the below code, I want to end up with values in column 'A', and a hard coded value in column 'B' for each row in column 'A'. But, I'm ending up with the hard coded value just in the first row of column 'B'. In other words, I want to repeat a value and copy it down column 'B' the same number of times that there are values in column 'A'. Here is what I am working with so far that is producing just the value in the first row of column 'B' -

Private Sub dispnames()
Dim b As Integer
Dim r As Integer
Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets

View 7 Replies View Related

Create List From Same Cell On Multiple Worksheets

Oct 11, 2007

I'm simply trying to take for example cell A1 from multiple sheets and list them vertically on a master sheet. When you drag it down it does not alter the sheet number, that just stays static.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved