Macro To Rename Tab With Range

Sep 10, 2009

From my research on trying to apply this function, I have peiced together several codes and am unable to get my end result. I want to add a worksheet and rename it with text formula on my main "Macro" sheet from cell D1. The name in cell D1 is a date that changes based on a formula. I can get the macro to add the worksheet but then it stops at renaming it:

Sub NewTab()
'
' NewTab Macro
' Macro recorded 9/10/2009 by andrea_1
'

'
Dim wsNew As Worksheet

Set wsNew = ThisWorkbook.Worksheets.Add
ActiveSheet.Select
ActiveSheet.Name = Worksheets(Macro).Range("D1").Value

End Sub

View 2 Replies


ADVERTISEMENT

Rename Range Names Via Macro

Sep 7, 2007

I am trying to automate the updating of range names in a spreadsheet.

On Sheet 1 Col 1 I have the names of all the existing range names.

In col 2 the new range names.

On sheet 2 the data referenced via range names.

I am getting stuck renaming the old range to the new name.

Sub Test()
Dim sName As String, nName As String

Sheets("Sheet1").Select
Range("a1").Select
Do While ActiveCell ""
sName = ActiveCell.Value
'MsgBox sName
Application.Goto Reference:=sName
Sheets("Sheet1").Select
ActiveCell.Offset(0, 1).Activate
nName = ActiveCell.Value
Sheets("Sheet2").Select
ActiveCell.Name = "nName"
Sheets("Sheet1").Select
ActiveCell.Offset(1, -1).Activate
Loop
End Sub

View 9 Replies View Related

Rename A Tab Using A Macro

Jul 7, 2009

Is it possible to have a macro to prompt the user for a tab name, check if it exists and if so copy it and ask the user for the new name for it to be rename to?

View 8 Replies View Related

Macro To Rename Sheet Tab

Aug 24, 2012

I run a report each month which renames the tab name called ex. "xxxxx Report 8". The 8 meaning for the month of August. I have created a macro to rename the tab, but each month when i generate the report the tab name change, hence i would have to change my macro again to reflect the tab name. What formula could i use in VBA to change the name of tab so i would not have to change my macro each month?

I currently use as shown below, which does not work since the number changes each month when i generate the report):

Sheets("xxxxx Report 8").Select
Sheets("xxxxx Report 8").Name = "Monthly Report"

View 4 Replies View Related

Possible To Have A Macro Rename A Worksheet?

Aug 2, 2008

Is it possible to have a macro re-name a worksheet. The context I want to use it would almost as a conditional formula.

Example: IF A1 = "time sheet" then sheet1 is then re-named to "time sheet"

View 9 Replies View Related

Move/Rename Macro

Aug 6, 2008

I have a workbook with 52 worksheets.
6 are hidden, 46 are visible.
I am trying to move a worksheet to the end of the workbook and rename as the next sheet.
It works the first time I run it (it renames the worksheet to Client51, the new last worksheet) but after that it gives me a 1004 error 'cannot rename a sheet to the same name as another sheet...."
Here is the macro I am using:

Sub rename_client()
Dim NewName As String
ActiveSheet.Move Before:=Sheets(Sheets.Count)
NewName = "Client" & Sheets.Count - 2
ActiveSheet.Name = NewName
End Sub

View 9 Replies View Related

Using Macro - How To Rename Filenames In Folder

Sep 22, 2010

I need tht How to rename the Filenames in an Folder using macro.. Is it possible, How we can do it..

Example: In an Folder 200files are there with extension .jpg/xls/bmp/txt/doc files, I want to rename tht those files names,

Example1:
Source File: TestImage.jpg
I want rename as
Destination file : image.jpg.

Not only Single file rename..if I want to rename Bulk means?...

View 14 Replies View Related

How To Create A Macro To Add New Worksheet And Rename It

Aug 25, 2009

I tried recording a macro to add to a new worksheet, but it gives error while running.

Issue as I understand is, by default excel gives a new worksheet a name (Say Sheet 4), and when u run macro worksheet, new created name may be different.

View 7 Replies View Related

Copy And Rename Macro Not Working

Jul 16, 2012

I have a workbook contains 2 sheets, Admin & Master. I have a list (A:A) on Admin sheet having dates based on a drop down menu somewhere on other side on the sheet. I am running the below customized code that i found online to copy the Master sheet and then it should get renamed as per list (A:A).

Public Sub CopyRenameIt()
Sheets("Admin").Select
' Determine how many territories are on Admin sheet
FinalRow = Range("H65000").End(xlUp).Row

[Code]....

View 1 Replies View Related

How To Create Macro To Add New Worksheet And Rename It

Oct 3, 2012

I need to have many users press a button within the excel sheet that duplicates the form from the current page, opening a new tab (copying the form) that also prompts to input a specific name e.g. "Enter date and day or night shift" to name the tab itself.

I have just worked out how to put a Command Button in and used the above code to create the new page assigning the code to it.

I need the "my sheet" to be prompted and customisable.

View 3 Replies View Related

Macro To Rename Files In A Folder

Jun 16, 2014

Macro to rename files

I have following problem, discribed also in the link above.

I need a vba code to

- choose a folder instead of a file
- find all the files in the chosen folder with name that starts with "sz" and end with "_d"
- rename those files by replacing the first 5 numbers that follow sz with 5 different numbers that the user can choose e.g. through a user form.

I imagine the user to open the excel file, click on a form thats linked to a macro. The macro will call a userform and ask the user to choose the folder and type in a textbox the 5 new numbers.

I need the code that will be pasted behind the "OK" button in the userform.

Is this possible with vba?

Here a code i found in the link mentioned above, that i have applied and works - but needs to be modified to meet my needs:
Sub GetImportFileName()

Dim Filt As String
Dim FilterIndex As Integer
Dim Title As String
Dim FileName As Variant
Dim newname As String

[Code].....

View 2 Replies View Related

Macro To SaveAs And Rename A File

Oct 15, 2009

I think my code is close but I keep getting an error "Run-time error '1004': Application-defined or object-defined error"

I am trying to rename the active workbook by appending yesterday's date onto the filename, using the Save As.

I might be going about this all wrong anyway. My user needs the macro to save, rename, and close the renamed copy of the workbook but to leave the original workbook open. I'm trying to do it in steps so I might be doing this the hard way. However, my code to Save As is below:

Sub SaveAsRename()

Dim CurrentPath As String
Dim CurrentFileName As String
Dim NewFileName As String
Dim Today As Date

Today = Int(Range("A3") - 1) 'Cell A3 contains the =Today() formula
CurrentPath = ThisWorkbook.Path
CurrentFileName = "QU Backhaul Dispatch "
NewFileName = CurrentFileName & Today & ".xlsm"

ActiveWorkbook.SaveAs Filename:=CurrentPath & "" & NewFileName

End Sub

My Locals window has all of the correct values right up to the ActiveWorkbook.SaveAs which is where it fails.

View 9 Replies View Related

Click Button To Rename Sheet Tabs Based On Range

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

Macro - Using Sheet Template Need It To Auto-Rename

Aug 2, 2008

*Inserts an existing worksheet template and places it at the end (or after all) the existing worksheets.

What I would like the macro to also do is:

*Automatically rename the inserted worksheet (via my worksheet template) in sequence to the existing worksheets

Example: So let's say I have 3 existing worksheets titled Sheet1, Sheet2, Sheet3 (that's basically the default naming Excel uses). But would when I insert a new worksheet (via my worksheet template) it is shown as Sheet. And if I insert another one, it would be Sheet (2). So basically it is showing as such:

Sheet1, Sheet2, Sheet3, Sheet, Sheet (2)

What I would like the macro to do is automatically rename those last 2 worksheets (and any subsequent worksheets thereafter) in sequential order. Basically displaying it as such:

Sheet1, Sheet2, Sheet3, Sheet4, Sheet5...(and so on and so forth)

View 10 Replies View Related

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

Rename Active Worksheet From Personal.xls Macro

Mar 12, 2009

I am having trouble renaming an active sheet from a Macro I stored in the personal.xls file. I want the active sheet to be renamed to "Data_Source" and then the rest of the code can kick in. Instead of renaming the current worksheet it creates a new one.

View 4 Replies View Related

Excel 2007 :: Macro To Rename Table?

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

Macro That Will Rename A Worksheet Based On The Value Of The Cell?

Jul 28, 2008

Is it possible to write a macro that will rename a worksheet based on the value of the cell?

For instance, if cell a1 has the value Test, the worksheet should be named Test. If I change the value of the cell to say Test 1, the worksheet should automatically rename itself to Test 1.

View 9 Replies View Related

Rename Multiple Files In A Folder Macro

Jun 11, 2009

I have 400ish departmental budget files in a folder that I need to upload to a Sharepoint doc library. The files in the folder will have to exactly match the files we already have set up in sharepoint in order to upload them to the sharepoint site. As it stands now there is only one consistency between the sharepoint files and the budget files in the folder, which is the department number (which every file in both begins with).

I'm thinking some sort of macro will let me insert a sheet into each of the files in the budget folder, which would have a formula that pulls the department number from a certain sheet in the file, and produce the file name I want into a certain cell. Then I would like a macro that goes into each file and renames it based on that cell. I'd like to know if this is possible and if there may be a better way to do it.

View 9 Replies View Related

Temp Macro To Rename Macro

Sep 8, 2008

Is it possible for a macro to rename a macro? I have a Temp macro that I want to rename to Auto_Open (or maybe auto_close).

View 9 Replies View Related

Rename Macro In Properties Window Loses Shortcut

Dec 2, 2008

I recorded one that does a very simple task, converts formulas to values. I saved it in my personal workbook, all is well. I noticed that excel names them Module1, Module2 etc. I thought it would be better to name them, so in the properties window next to "name" i changed Module1 to ConvertFormulas.

However, when i go to a worksheet, the keyboard shortcut no longer works. Reverting back to the old name Module1 solves this. Clicking Tools -> Macro -> Macros, selecting ConvertFormulas and then Options and modifying the shortcut.

View 4 Replies View Related

Macro To Rename A Worksheet To Numbers As Of [+today's Date]

Feb 17, 2009

I'd like a macro to rename a worksheet from its current name of "FullScreen (2)" to say Numbers, plus today's date (without the plus) For example... Numbers as of 02-17-09

View 2 Replies View Related

Macro Code To Add New Sheet And Rename With Data Given In Cells

Feb 11, 2014

I need a macro code to add and rename sheets as per data given in column "A".

ie if column A has
SBC
DFG
UY
IKJ

4 new sheets to be created with name given above (Column A). PS:- the data given in column A will not be limited to 4 rows, it ll be > or < 4.

View 9 Replies View Related

Macro To List Files Then Rename Based On Other Cell

Mar 25, 2014

I have a macro attached with attached file; it will list the files then will re-name the files based on other cell

example;

Cell A2 = New.mp4
Cell B2 = ggffrr.mp4

so the file New.mp4 will be renamed to ggffrr.mp4.

it is working fine but the location will be always desktop or documents location

i need from the macro to rename the files and to keep them in the same location.

View 1 Replies View Related

Macro - Rename Only & Sheet... & Tabs With Last 8 Characters From Cell

Nov 5, 2009

I pull an excel sheet from a database each day that gives me sales data for different products sold. The way the spreadsheet comes from the system, the first tab is named "Document Map" and lists all of the products, and each product then has its own tab but they're generically named (Sheet1, Sheet2, etc.). The name of the product is always in cell T8, but the name itself is only the last 8 characters of that cell.

What I'm hoping to accomplish with a macro is two things:

1) Retrieve the last 8 characters from T8 in each tab, and name the tab with those characters (same effect as the formula "=right(T8,8)").
2) Ensure that this only occurs on tabs with the word "Sheet" in the beginning. Depending on the day, there could be any number of products and they each get their own tab, so I was hoping to be able to get the macro to only work on sheets where the first 5 characters are "Sheet" regardless of the number after that.

View 9 Replies View Related

Macro Rename Excel Files Based On Cell Contents?

Jun 23, 2014

Can a macro rename Excel files based on a cell's contents? The problem maybe that I download these files en masse from a website and they all have 54-character long randomly generated filenames which I can rename by selecting all and then use the rename function to get a series of filenames like a, a(2), a(3), ... but I would rather have the files renamed based on the text that exists in cell B1 which is the title of the report. I also read somewhere that this kind of macro only works if the tabs have names like "Sheet 1"

View 1 Replies View Related

Macro To Create And Rename Multiple Worksheet And Then Placing Relevant Data

Feb 24, 2014

I want to find a way to create multiple worksheets and matching data to be placed on appropriate sheets.

Here are more details (Please check the attached sheet screenshot as well):

Excel_Macro_Requirement.jpg

In a workbook, there is a "Master-Sheet". This master sheet contains 8 columns.

I want to create as many new worksheets after master sheet as the values are there in column B (Column 2 i.e. Ad Group). In above attached screenshot, there are 8 values (B2:B9 or A-H). So, I would like to create 8 new worksheets after the master sheet. Also, I want to rename them based on their value from Ad Group column.

Each newly created worksheet should have same columns as the master sheet . Same 8 columns with their name intact.

Finally, I want all matching data of the Ad Group values to be placed on their respective newly created worksheet. For example, worksheet A should have A2:H2 data. Worksheet B should have A3:H3 data, and so on.

Please note that same ad group may have more than one row data. But I don't want to create multiple worksheet of same name ad group. The worksheet should be just one, but all matching data should be placed in that one sheet.

I know it is a bit complex task, but I am sure there would be a way to perform this automatically - probably a macro.

View 1 Replies View Related

Input In Cell Triggers Macro To Create Duplicate From Template Sheet And Rename?

Jan 22, 2014

I am currently doing an excel database of students application. I want a macro that creates a duplicate of a template sheet and renaming it based on the name of the student. Meaning once a name appears in the name cell, a sheet of that particular name is automatically created. At the same time, i want all the data regarding the applying student to appear the newly created sheet as shown in the attached file.

View 4 Replies View Related

Macro Copy Of The Active Sheet And Then Rename The New Copied Sheet

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

Keeping Track Of Which Macro Is In Which Module Since You Can't Rename The Module?

Mar 27, 2009

After all the awesome macros I've obtained with the help of all of you, I now have over 30 macros, each in its own module. I have tried without success to re-name the modules with no luck. How is everyone organizing these?

View 2 Replies View Related







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