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
ADVERTISEMENT
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
May 6, 2013
I am trying to create a macro that will open certain files based on the contents of a cell. There are three possible files that I will want to open.
File1.xlsx
File2.xlsx
File3.xlsx
If the contents of cell Q2 = 10, 20, 30, 40 or 50 then open "File1.xlsx"
If the contents of cell Q2 = 60, 70 or 80 then open "File2.xlsx"
If the contents od cell Q2 = 90, 100, or 110 then open "File3.xlsx"
If the contents of Q2 do not equal any of the possibilities listed then I would like an error box to show with the option to end or debug the code.
View 3 Replies
View Related
Nov 10, 2009
I have 5 sheets. In the first sheet I have set up 4 cells where I want the contents of them to automatically rename the other 4 corresponing sheets.
Eg.
In Sheet 1, Cell B6, I want the contents (which will be text) to be the name of sheet 2 automatically.
In Sheet 1, Cell B7, I want the contents (which will be text) to be the name of sheet 3 automatically.
View 8 Replies
View Related
Feb 19, 2010
I would like to copy every file named "Current Day.csv" from every subfolder found in the folder c: est
Rename the file as the value in A1 (3 digit code) and B1 (date) and save the file into v: est (and the folder name the file orginally came from)
Is that possible? (looking at about 30 filesfolders so if need be I can define the folder names)
View 9 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 28, 2014
I have a excel file where I have the list of File Path in Column A & list of File names in Column B, Default path location is available in Column C. Now I want create a zipped folder based on the file name in Column B to the location Column C. I had browsed in Internet and found some code for creating the zipped file by selecting the files in Windows browser window. However my case is need to create the Zipped file based on excel cell contents.
I had found the code in the following location
Zip file(s) with the default Windows zip program (VBA)
create a code for creating the zipped folder based on Excel cell contents
View 2 Replies
View Related
May 26, 2013
I have several .mp3 files in a directory that I'd like to rename based on a list.
Currently I have a sheet with two columns starting at "A2" and "B2"
Column A contains the file path and old name (without extension) ie: C:RenameFromListOldName_01
Column B contains the file path and new name (without extension) ie: C:RenameFromListNewName_01
I've modified the code below (obtained here on these forums) to work with mp3 files, which renames them, but it also corrupts my files.
VB:
Sub Rename_Files_from_List()
Dim oFiles As Range, fPath As String
Set oFiles = Range("A2", Range("A65536").End(xlUp))
fPath = Range("D2").Value
[Code] .....
View 4 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
Nov 10, 2006
I regularly receive many files that require renaming. Column A contains the current name and column B contains the desired name. Could anyone tell me how to use these lists to rename the files?
View 4 Replies
View Related
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
Jan 11, 2009
I'm using 2007 Excel and I have a list of 200 JPG files on column A which mirror actual file names of files I have located in C:photos.
My objective is to use Excel 2007 to batch rename all the files located in C:photos from the names listed in column "A" to the names listed in column "B" that I have created.
a VBA script that will accomplish this task?
View 4 Replies
View Related
Mar 10, 2013
I am trying to rename a lot of files within 1 folder. The Spreadsheet Column A contains all the old file names within a folder and Column B has the new file name. (1)My code is below but I continue getting an error that the file isn't found. (2) I would like to start with row 2 because row 1 will contain the folder path as a result of another macro.
[Code].....
View 2 Replies
View Related
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
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
May 30, 2013
After working on this script for a while, I have come up with this.
Code:
Sub CopyAndRenameImages()
Dim fs As Object
Dim oldPath As String, newPath As String
Dim LastRow As Long
Const PW As String = "Password"
[Code] ..........
Handler:
MsgBox oldPath & " cannot be found."
Resume Next
End
End Sub
But for some reason it is always pulling an error on the last item in the list, even if the file is there.
View 1 Replies
View Related
Sep 22, 2013
For the last year I have been downloading cash register X1 and Z1 files onto an SD card. Each night's files (X1 & Z1) are stored in a new folder with the naming convention "RP + [DATE]", (EX: RP120910, [YYMMDD]). I have 265 folders! I need to go through each folder, select the Z1 file (I don't care about the X1, X2 or Z2 files) and rename each with the following naming convention: "Z1 + folder_name + .xls". For Example: Folder RP120910 contains the Z1 file named "Z1_T1729.ECR". After renaming, the file should be "Z1RP120910.xls". As the VBA code loops through each subfolder, selecting and renaming the Z1 files, I would like the new files to be placed into a new folder named "Z1Files". Note: All subfolders are currently in a directory named "RegisterFiles". I am using Excel 2010.
View 3 Replies
View Related
Sep 12, 2013
How to Lock/Unlock an Excel Cell Based on the Contents of Another Cell?
View 1 Replies
View Related
Jul 30, 2013
I'm using excel 2010 and windows XP with a moderate amount of experience tinkering with macro programming. I know what I need is very doable but I can't get my head around what the code would look like. I must not be wording my searches correctly because most of what I'm getting for results are iterative programs based on a cells value which isn't what I need.
I'm trying to build a macro that will check a cell (C3) and based on the contents of that cell copy a column (I) to one of 12 different columns (K:V). So if the value in C3 is 1 it should copy I to K, if the value is 2 it should copy I to L, and so on.
View 2 Replies
View Related
May 13, 2013
Basically lets say I have in cell A1 to A10 floor access data i.e. Users who used their ID cards to access a room.
Now the data always starts with either Rejected or Admitted then the user's name and then the card number and the access floor etc. the card currently has.
What I am looking for is that the macro should first check if the cell has Rejected or Admitted written in it - this I can do myself using =Left(A1,8) which should give me the helper column I need.
Then based on this I want it to only copy the name of the individual i.e. it should look in the cell and only copy whatever is written between "Rejected" and "(Card". The cell data is something like this:
Rejected Doe, John (Card #123456) at ABC 123 Floor1/Floor2/Floor3/Floor4 Door 1 [In] [Clearance]
View 4 Replies
View Related
Aug 18, 2009
I have a spreadsheet that has a subtotal row after each data grouping. I need help with a macro that will go to column C, look for any cells with the word "Subtotals" in it, and format that row based on another macro I already have set up. I've tried about 50 different types of macros that I found out on the web, but none have worked.
View 9 Replies
View Related
Jan 4, 2014
how I can loop through folders to select files starting with a certain word and copy all of them to a different folder and rename them. The folder structure is given below
Company 1(parent folder)
North South East(sub folder) West(sub folder)
Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec Jan Feb Mar.... Dec
In the above structure, the files are present inside each folders Jan, feb...Dec under the regions North, South East n west. note that I have to select files starting with "Sales" and copy them into a new folder(say results) and rename copied files as Sales1.xls, Sales2.xls etc. (Files are not present in the folder company1, north, south, east and east.)
View 1 Replies
View Related
Feb 18, 2009
Been racking brain, searching through the forum here, and my Excel 2003 Bible all day trying to figure out this problem to no avail. I would like to clear the contents of any cell in a given range if the cell immediately to the right of is formatted as bold.
View 2 Replies
View Related
Aug 16, 2012
I have a worksheet that has a number in cell K5 - the number is generated on "file open" code and is custom formatted as "TN"0000. Thus 1 appears as TN0001, 2 as TN0002 and so on. I am trying to save a copy of the workbook based on the this cells contents i.e. TN0001.xls, TN0002.xls etc. but the files are saved as 1.xls or 2.xls. The code I am using is
ActiveWorkbook.SaveAs Filename:="C:DataExcelFORMSDelivery Note" & Range("K5") & ".xls", _
FileFormat:=xlNormal, ReadOnlyRecommended:=True, CreateBackup:=False
I know I must make reference to format within the above....but how? if try something like
" & Format(Range("K5").Value, ("TN""0000")) & ".xls"
I get TN00000.xls
View 2 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 12, 2014
I thought this was a pretty simple formula but I am having difficulty creating it. I am attaching a little test spreadsheet. Sheet 1 is where the data will be entered. The Reimbursed column has a drop down choice of yes or no. The next 2 columns are the cost of registration and the cost of accommodations. On sheet 2 is where I would like the formulas. So in cell A4 I would like a formula that says if B3 on sheet 1 is Yes populate this cell with the contents of Cell C3 only, B4 of sheet 2 would then be B3 if A3 on sheet 3 is Yes and so on with the Not reinbursed if sheet 1 the Reimbursed column is no.
View 3 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
Mar 11, 2013
I am looking for a macro to rename tabs based on information in A1 on each tab. The thing that is causing me issues is the cell A1 has a formula in it and it changes on a daily basis with days of the week but the tab only updates when i double click A1 and press enter.
I need it to update automatically.
View 4 Replies
View Related
Aug 19, 2014
I would like to open 3 excel files (with identical names) from 3 different mapped drives eg M,N and O. How can I use Excel VBA to rename these 3 files based on their original locations and save them in a folder in the C drive eg M_Filename,N_Filename and O_Filename.
View 3 Replies
View Related
Feb 2, 2009
I want to rename some files that I have in a folder, the names I want to end up with are in an excel sheet.
So the below 2 files are what 2 files are call currently, the file name below is what I want to change it to.
01 - Whigwield - Saturday Night.cdg
01 - Whigwield - Saturday Night - which is a music file.
I want to rename the file to this,
SF010-1 WHIGFIELD - SATURDAY NIGHT
The next file is
02 - Take That – Sure.cdg
02 - Take That – Sure – which is a music file.
I want to rename it to:
SF010-2 TAKE THAT - SURE
View 9 Replies
View Related