VBA To Copy Sheet And Rename Based On A Table
Apr 22, 2013
I have a macro which does the following:
1) Copies Sheet2 for each name on the list. Sheet1 has the list of names (cells A5:A10)
2) Renames each sheet with the next name on the list
3) In each of the copied sheets in cell A2=newsheetname
Sub Copy_Sheets()
Dim i As Integer
Dim wks As Worksheet
Set wks = Sheets("Sheet1")
For i = 5 To 10
[code].....
This works like a charm for this particular list. The thing is, I want to take this macro and apply it to a variable list. In one instance the list may be in cells A5:A10, and in another instance it may be in cells A5:A100. How can I update my macro so it looks for the next name in the list and stops when there is no longer a name.
View 2 Replies
ADVERTISEMENT
Jul 28, 2014
I've been working on a macro that makes copies of a template sheet based on a table in my Opps sheet. If column B isn't empty, make a copy of the template sheet, rename it to Opps column A, and then hyperlink column A's current A.row to the newly copied and renamed sheet.
I'm not sure what is wrong exactly, it keeps making duplicate Template(x) and stops renaming them, and the hyperlinks are not working. -This is my first go at VBA hyperlinks to internal workbook sheets
[Code] .....
View 5 Replies
View Related
Dec 31, 2008
I have a spreadsheet that I enter daily totals into. The sheet is named by date.
I take totals from a number of catagories from the prior day's sheet (ending totals) and enter them on the current sheet (beginning totals), then enter the current day's totals to wind up with new ending totals.
I want to generate a new sheet in the same workbook based on the date of the prior sheet, copy my formatting, and copy the data from the old ending sheet totals to the new sheet beginning totals.
View 4 Replies
View Related
Jul 30, 2009
I'm trying to create a copy of the active sheet and then rename the new copied sheet to what's in cell O4, which is a formula (see below) and then paste value cell O4 in B3 of the copied sheet. However, when I run this macro it doesn't seem to like the second line where I am renaming the sheet (run time error '1004').
"O4" =DATE(YEAR($B$3),MONTH($B$3)+1,DAY($B$3))
Sub NewMonth()
ActiveSheet.Copy Before:=Sheets(Sheets.Count)
ActiveSheet.Name = Range("O4").Value
ActiveSheet.Range("O4").Copy
ActiveSheet.Range("B3").PasteSpecial Paste:=xlPasteValues
End Sub
View 9 Replies
View Related
Dec 21, 2011
I have about 100 products and each has its own sheet that I fill with data. Once I have finished with a sheet I rename it and create a copy and then hide the original and delete the entered data from before and start over.
Is there a way I can make it so when I hide a sheet it will automatically create a copy and delete a specific range?
View 1 Replies
View Related
Jul 15, 2014
I have all games saved, each game into it's own sheet (tab), in a workbook. Game 1 is on Sheet1, game 2 is on Sheet2 etc etc
I also have a "Calculations" sheet that I wish to import each game into 1 at a time, and run a macro on it to run a stat tracker.
Is it possible to create a table, that I can type the sheet name "Sheet1" into a cell, it will have that table populate with all the info contained in "Sheet1"?
Here is an example of my spreadsheet
View 4 Replies
View Related
Oct 12, 2013
I have a template sheet which i want to copy in to same workbook but want it to be renamed using a name which i fill in on a seperate sheet "articles". But I only want the template copied with the new name every time i fill in a new name in the sheet "articles". Also this procedure may not overwrite existing sheets.
So there is not a predipefined table in articles but rather it grows each time I need a new copy of template.
View 4 Replies
View Related
Jun 14, 2014
Is it possible to copy sheet and rename the copied sheet in one operation .... have a hidden worksheet that needs to be copied and given a variable name dependent on the work sheets that are already present.
View 4 Replies
View Related
Feb 21, 2007
Sheet1 has the list of names (cells A2:A315). Sheet2 is hidden and has related formulas. Sheet7 is the sheet i want to copy
What i want to do:
1) I want to copy sheet7 for each name on the list
2) Rename each sheet with the next name on the list
3) In each of the copied sheets in cell B1=newsheetname
View 3 Replies
View Related
Oct 11, 2013
What I'm looking to do is copy sheet named January, and paste into a new sheet naming it February, then in February copy and paste into another new sheet naming it March and so (but keeping previous months). My thinking was a pop up to name the sheet to copy then another to name the sheet that it's pasted in.
View 2 Replies
View Related
Jan 16, 2014
Need achieving the following:
I have 2 sheets in one workbook, the first sheet named D1 where I have dropdown menus and the second sheet called reference where I have fixed data
what im looking for is when the user select an option from the dropdown menu on cell b3 on "D1" sheet based on the selection an entire table (4 rows by 3 columns) called "Default" from reference sheet to be automatically pasted into the D1 sheet.
View 1 Replies
View Related
Oct 30, 2008
I am looking to do is make a copy of a hidden sheet named "Date" and rename the sheet tab based on a list of dates that I have on another hidden worksheet named "Date Names" I like the code to enter as many sheets as needed.
The dates are in order from A1 to A53 on the "Date Names "sheet .
View 7 Replies
View Related
Jun 30, 2014
I need to copy 120 columns from one sheet to a new. The columns needs to be in a certain order. So I need fx. from the original sheet column 2 is called "number" and I need that column to be put in new sheet as column 1 with new headline "no." Guess I need almost the same code for all of the just with different names etc.
I also need to put in blank columns with specific headlines in between some columns - so fx. in column 4 I need a blank column with headline "search"..
View 3 Replies
View Related
Jun 23, 2006
i would like to copy a sheet to another sheet, rename, copy and paste special values. but after the sheet is copied to another, the macro stops working...?
Sheets("Proposal").Copy After:=Sheets("Proposal")
'rename...
ActiveSheet. Name = "ProposalEmail"
ActiveSheet.Copy
ActiveSheet.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks _
:=False, Transpose:=False
View 2 Replies
View Related
Oct 27, 2008
EXAMPLE: Complete Sheet called "Day1". When day1 is complete you click on button and it then copies itself and creates and renames new sheet to "Day2", then when "Day2" is complete you click on button and it then copies itself and creates and renames new sheet to "Day3", and so on and so forth to "Day30".
View 9 Replies
View Related
May 17, 2008
I'm looking for a solution that will rename the sheet to whatever is enterd into particular cell.
Ie: cell A1 = "Joe Bloggs", then the sheet is renamed to Joe Bloggs
Also, on the same sheet, is it possible to change the sheet tab colour based a data in a different cell?
Ie: cell B1 = "Parts", then the sheet tab colour changes to pink.
View 14 Replies
View Related
Aug 11, 2006
I have a list of names in sheet1, starting with cell A3. I would like to copy sheet3, insert it after sheet3 and rename the sheet to correspond to the names in the list.
If i have 30 names I would like 30 sheets. If i add a name, I would like to repeat the copy, insert and rename steps for the extra names as i add them.
View 7 Replies
View Related
Jul 31, 2013
I receive a workbook each day with approx 500 tabs of call data and I would like to relabel all the tabs with the user names. The user names are in a merged range "A7:M7". I'm having difficulty getting the following script to rename the sheets. Currently the values in "A7:M7" look like "User: ADAM ENGEMANN-558".
I am trying to delete each occurrence of "User: " while naming the sheets as well as removing the merged range before doing so that the names are in A7 only. The sheet names should look like "ADAM ENGEMANN-558", or, ideally just "ADAM ENGEMANN". For some reason my code will not modify the cells. (See attached example)
This works if I manually unmerge the cells before running and remove the ":".
VB:
Sub RenameSheets2()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Range("A7").Value <> "" Then
[Code] .....
This his how I modified it but it doesn't work on the supplied sheets. Please note that if I manually insert some blank sheets into my workbook and merge the cells etc it does work. There seems to be something odd going on with the sheets they are giving me. (they aren't protected)
VB:
Sub RenameSheets2()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Range("A7").Value <> "" Then
I tried adding the following to remove the merged ranges and remove 'User: ' from the names
Range("A7:M7").Select
With Selection
.WrapText = False
.MergeCells = False
[Code] ......
CallSample2.xls
View 3 Replies
View Related
Aug 17, 2014
I am having trouble creating a macro that renames all excel sheets using cells on Sheet1.
See attached, I want to rename all excel sheets (renamed as "1", "2", "3"....."50") as "9999", "10000", "10001"..."10045", found in Sheet1, renamed as "Base". I will change the cell values everyday (range Base!A5 to Base!50) - and will rename all the sheets again.
Before: before.jpg
After: after.jpg
View 2 Replies
View Related
Jul 29, 2009
I am building a workbook. The data we are tracking is all in one xml file, which i have mapped to 3 different worksheets(customers, invoices, inventory). On the customers and inventory sheet I have an interface for creating a new customer/product/invoice. I used the macro recorder to make the macro's to do these three things, but could use help on a couple of other functions as I don't actually know VBA. I need to be able to automate editing of existing records by having a button to press on the each sheet that will open an input box that asks the user which invoice number, customer number or product number he would like to edit, then copy that record to the interface for editing, then another macro to replace the existing data with the newly edited data. It would also be wonderful if when creating or editing an invoice it could create a copy of the interface worksheet and rename it as the invoice number. The first row of each datasheet is blank, and each of the interfaces have formula's for importing the information copied to row 1 from the data tables. the second row of each datasheet contains formulas for importing data from the interface. Any help would be terrific...I know you guys are excel gods and I will forever be in your debt if you can help me out....thanks in advance, I'll be studying my butt off until I figure this out
View 11 Replies
View Related
Jul 9, 2012
I'd like to split up the rows in a worksheet based on the values in one of the columns. Also, I'd like the sheets to be named after the values in the column. I have attached example excel sheets to explain this better. I think the vlookup and Sheets.Add and ActiveSheet.Name formulas can be used but I'm not quite sure how to put them together. The actual data has about 20 columns and about 500 rows.
View 6 Replies
View Related
Feb 10, 2014
I have a master sheet where users can change the name of 20 different sheets in the workbook by changing a cell value on the master sheet. Here is the code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rCell As Range
If Target.Cells.Count > 1 Then Exit Sub
[Code]....
The next step which I am having issues with is hiding the sheets. I want all sheets in the workbook to be hidden except for the master. I only want the other sheets to be visble if the user inputs a name on the master sheet.
So if the cell contents on the master sheet, say "B9", is blank, the sheet in the workbook that corresponds to that cell will remain hidden. If the user inputs anything, say "Sheet1", in cell "B9" on the master sheet, I want that sheet to become unhidden and to be named "Sheet1"
View 2 Replies
View Related
Jul 20, 2006
I searched a few times for the answer to my problem, using different search terms, but I've come up somewhat empty (this *might* be because I'm not up-to- speed with Excel's terminology?). Anyway, my problem is this: I have a workbook which is designed to track various data for a corporate training course ( sheets for attendance, grades, tool logins, etc). After all of these are sheets numbered 1-25 (we never have more than 25 students in a class, but usually around 20). The numbered sheets correspond to the student's number in the on the class list sheet (so, the first student would have personal "report card" information on sheet 1; the eleventh student in the class list would have their information on sheet 11, etc).
What I would like to do is have some way of putting a button on the class list sheet which would look at student list and rename the sheets to correspond to the student names. For example, if the fifth student listed was 'John Doe', it would rename his personal sheet ('5') to 'John Doe'. Obviously, I would need to do it for all of the students, and IDEALLY it would then get rid of any numbered sheets which are not used (having 21 students would only rename the first 21 sheets, but then hide sheets 22, 23, 24, and 25).
View 9 Replies
View Related
Feb 21, 2013
how to create a copy of my employee attendance template. Is there a way to create a copy of the template by entering an employee name in the "name" cell of the template and it automatically renames the sheet that employee name and also saves or recopies the template for use with the next employee?
View 8 Replies
View Related
May 14, 2014
What I have is a sheet that is copied periodically from some source sheet, and on this sheet is a table. This sheet is called "Onsite Checklist Template" and it's table is titled "Checklist". I also have another sheet called "Loggers and Initial Notes" which has a tabled titled "Record", and then finally a title sheet call "Proj Details".
To clear this intro up - The sheets, in their order, is: "Proj Details", "Loggers and Initial Notes", "Onsite Checklist Template". The tables: "Record" on "Loggers..." and "Checklist" on "Onsite..."
When the user wants to make a new site visit, he/she fills in the requested date and then selects a button on "Proj...". When this button is selected, it copies the table data on "Record" and puts it on "Checklist", then inserts a new worksheet tab, always in the 3rd position (the title is based on the site visit date in which the user entered), which is a copy of "Onsite...". Now we have another sheet with a table called "Checklist1", and upon another new site visit, there will be another worksheet with "Checklist2", and so on.
On the "Onsite..." worksheet, there is a button on it which also gets copied with the worksheet so that every new worksheet has this copied "Checklist ???" and this button. I'm looking for a macro that, when the button is selected, will bounce the active sheet's table "Checklist ???" off of "Record" and make changes as needed.
"Checklist ???" data range is B11:M20 (the header is on row 10); "Record" data range is B29:Q78 (the header is on row 28); Column headers are titled the same, just that "Record" has 4 extra columns, 3 in the middle and 1 on the end. "Checklist ???" columns 1-12 to "Record" columns 1-7, 10-12, 14-15. The search criteria is the 4th column in both tables ("Trk #").
I need the macro to do the following:If it finds a match, then update "Record" as needed with data from "Checklist ???", changing whatever cell is different in the row that contains the matching "Trk #", so long as the cell on "Checklist ???" is populated (i.e, if a cell on the target row of "Record" has a value, but it's blank on "Checklist ???", then "Record" wins; if it's blank on "Record", but populated on "Checklist ???", the Checklist wins. If both populated but different, then Checklist wins.If a "Trk #" exists on "Checklist ???" but is not on "Record" then add the line to "Record" (the 1st empty row, table size remains)I see no need for any "delete" at this time.
My concerns: The last column on record (column #16) is the filtering column for the worksheet copy event and needs to be left alone (it's formulated to produce a "Yes" or "No")I would like the ability to adjust table sizes if needed without modifying the macroThe table rows on "Checklist ???" will not be changed, deleted, or altered in any way by the macro.
View 2 Replies
View Related
Feb 2, 2010
I am getting the error from the title of the thread when I try to change a worksheet name.
This worksheet name doesn't already exist in the workbook and I don't have any other files currently open.
I'm not entirely sure what is causing this, but I do need the sheet to be the name I am trying to change to.
View 9 Replies
View Related
Apr 13, 2008
Why do I get the error: "Runtime error 1004: Cannot rename a sheet to the same name as another sheet, a reference object library, or a workbook referenced by Visual Basic"?
And how do I fix it? I have a macros that someone else made (thank you) and I need to make the macros create anywhere from 5-125 sheets based on the information added in sheet 1. How can I do this whe it stops me after 5 or so with the error above.
View 10 Replies
View Related
Jan 22, 2007
I want to copy and paste from one sheet to another based on column a using a macro copy button.
E.g. if column a value = apple then copy that row into the apple sheet.
View 9 Replies
View Related
Nov 20, 2011
I am trying to rename a excel table from its file name after importing the data into the current sheet i am working in. Is there a method for going this? I can do it manually easily, but when I try to record myself within a macro, it still uses the file's previous name in the code before renaming it. Using Excel 2007.
View 5 Replies
View Related
Mar 27, 2008
i have a workbook that has a lot of sheets but i need to pull information from the one sheet "Veneer Log" i Need it to make new sheets with the same heading as on the "Veneer Log" (Rows 1 & 2) Sheet but it needs to be filtered by the "Product" Column (H) with a new sheet made for all the diffrent products i.e. Dimensional, Drywall, Corners - Thin V., Accents,..... so each product will have a new sheet with i am hoping someone can help me with this. This log changes Daily and it would be nice to have a sheet with only the same product on it to compare new orders so we can batch run. i hope i have given you enough information so someone can help me with this. i have attached a sample log the real log has about 10 worksheet for diffrent departments but i only need info from the Veneer Log Sheet.
View 14 Replies
View Related