VBA Code To Move Multiple Files

Sep 3, 2013

I have a list of file names in Excel and I need to move the files from one folder into another. Sometimes I'm having to find and move hundreds of files into different destination folders, hence why I would like a macro. My spreadsheet will be something like:

Column A
Column B
Column C
Row 1
File name

[Code]...

View 3 Replies


ADVERTISEMENT

Code To Pull Data From Multiple Files?

Feb 16, 2010

I have the job of producing a survey in Excel and collating the results anonymously, to help with this I'm looking for a chunk of code that will enable me to pull a specified range of data from all the files in a particular drive with a filename starting with a specified word and insert them all in to the same blank sheet.

View 6 Replies View Related

Code To Take Averages From Multiple Files With File / Sheet Name?

Apr 9, 2014

I have a bunch of workbooks in a folder and I'm basically trying to take the average of the same specific range for each file. I have somewhat of a method for doing this where I separate it into several steps and grab bits of code for each step (there's descriptions on the code). How I can improve or streamline it?

Code:
'STEP 1
'run this first to combine multiple files/workbooks into one file
'Change MyPath to the folder location
Sub Merge2MultiSheets()

[Code]....

View 1 Replies View Related

Move Files Into Directories Using VBA?

Mar 2, 2009

In my Excel file, I have three columns: A, B and C. Column A holds the folder names. column B holds the files hash names. And in column C, i keep the files real names, i.e:

A1.value = Contract folder

B1.value = 23ffryu567894lkgj090

C1.value = picture1.jpeg

On my hard drive, I have all the folders (column A data) already created inside a folder called directories: E:directories... There is another directory on my drive in which I keep all the hash files: E:infiles

And all I would like to do now, is to write a piece of code to read all three columns row by row and based on the data in that row, moves the hashed file into their proper directories and rename them to their real name. In the example above, the program should read the data found in the first row: A1, B1 and C1 and move the hash file named 23ffryu567894lkgj090 to E:directoriesContract folder and rename the hash file to picture1.jpeg

View 14 Replies View Related

Move Files To Folder By VBA

Aug 6, 2012

In the code below I would like to add to move these files:

byemployee.csv
byposition.csv
status report.xls
bydepartment.csv

and if the file byband.csv exists, then move also otherwise ignore. I want to move to the folder Uploads which is also found under the variable MyPath

If it cannot be included in this code, then I have no problem with a new one.

Private Sub Exitbtn_Click()
Dim MyPath$, MyName$
Application.ScreenUpdating = False
Call chooseView.hideSheets
'Save the file to this path and type file name

[Code]....

View 4 Replies View Related

Move Files From One Folder To Another

Oct 29, 2012

I have the following two folders located in my D Drive:

1. D:FilesData

2. D:FilesArchives

I have lots of files (.txt) in the first folder (D:FilesData) from which I need to move all the files whose first character is starting with _(underscore) to the second folder (D:FilesArchives).

View 1 Replies View Related

Macro To Move Files Across A Network

Jan 12, 2008

I would like to include code to move or copy various csv files from one computer across a network to other computers.

To date the best I have come up with is a method of running a batch file that executes the action.

Sub moveTKRS()

Call Shell("C:MoveTKRS.bat", vbNormalFocus)

End Sub
I would rather a more direct code that does not require a batch file.

View 9 Replies View Related

Move Files From One Folder To Another Up To Maximum

Feb 7, 2008

I am trying to create a chart that will automatically expand to include additional rows. I have seen posts and examples of the kind of chart I am aiming for, but only showing one series… my chart needs to show several series and be able to add new ones in automatically. For example, I want to make a chart showing the Total Market, and each separate manufacturer, over 13 time periods. If a new manufacturer appears, I would like the chart to show it without having to manually change the source data. (see attached spreadsheet)

View 2 Replies View Related

Files To Move To Folder Created By Another Macro?

Aug 11, 2014

I have the following macro set up to create a folder in a directory as per the contents of 2 cells

C2 = Folder name to be created
B2= Date for previous working day

[code]....

I then have another macro that moves files into a specified folder within the same location ( I then manually move them into the folder the first macro created)

Is there a way I could get the files to move to the newly created folder without me having to do it manually.

View 4 Replies View Related

Move Files To Another Folder Delete Original

Sep 8, 2009

i would like to be able to move files from one folder to another then delete the original files.
I dont think im passsing the variables to the functions corectly.

View 8 Replies View Related

Look In Specified Folder For All Files, Move Them To Main Workbook

Jul 21, 2008

I have this code so far using Macro Recorder but i wanted to change a few parts which i am not too sure how to do:

Its basically supposed to look in specified folder for all files, move them to Main Workbook & rename them slightly

Sub getcsv()
Workbooks.Open Filename:= _
"C:Documents and SettingsSlimDesktopPositionsChartsAUDCADm1440.csv"
Sheets("AUDCADm1440").Select
Sheets("AUDCADm1440").Move After:=Workbooks("Position Risk Calc v9.8.xls"). _
Sheets(23)
End Sub............................

View 9 Replies View Related

Copy And Rename Files In VBA By Searching Multiple Folders For Files?

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

Move Files To Dynamic Folders Based On Cell Value

May 13, 2007

I am not so sure this can be done through a macro, but here is what I want.

I have a folder with say around 1000 excel workbooks. I need a macro to

1. Open each file in the directory specified
2. Read the contents of a particular cell, for ex, A1
3. Create a folder in the same directory with the value of A1
4. And, move the excel workbook itself to that folder.

5. Then it opens the next file
6. If the value of A1 is the same as that in the first workbook, it simply moves it to the already created folder, else it creates another folder with the new value of A1 and moves it there.

Hope I am not too confusing. Searching the forums does not give me an exact picture of how it can be done.

Note: I would also like an option where when I execute the macro, it should pop up with an option to select the folder in which the files are, since the files are not always saved in a static file path.

View 6 Replies View Related

Get Data From Changing Filenames & Move Files To Another Folder

Nov 22, 2007

I am trying to develop an excel macro to accomplish the following:

-I have a master workbook for collecting data
-One folder will be used to dump excel files into; I don't know the filenames (other than "*.xls"), but I do know from which cells I will need to retreive data (they will be the same for all files)

1. I need to retrieve data from these excel files
2. After getting data from a file, it is then moved to another folder
3. Next the retreive data, then move is performed on the next excel file until there are none left in C:IN

Upon searching this forum, I found a way to open each of these files one by one (without having to know the filenames): Using a script to open unspecified file name

- For me, the obstacle seems to be not knowing how to do what I need to without knowing the filenames

- Again, the issue - retrieve data from these files, then rename/move these files

View 7 Replies View Related

Save Ranges In Multiple Files To Text Files

Dec 21, 2007

I have a excel file that I enter information into. I have code that saves the files to a certain folder with the name, date, and time stamp for the file name. At the end of the day I might have 3 to 15 excel files I have created that day and I would like to take information from certain cells (examle: L3, B6, B7, B8, G8, and so on) and create a txt file with all of the information in it.

Example:
12/20/2007
Your Name
123 Somewhere St.
Here, OH 45111
Home Visit

12/20/2007
Someone Else
345 Anywhere St.
There, OH 45211
Hospital Visit

View 9 Replies View Related

Excel 2003 :: Copy And Move Files To Create Backups For 7 Or 8 Years

Aug 30, 2012

Using Excel Office 2003.

I have been using VBA to copy and move files to create backups for 7 or 8 years now, and it works great. However, recently I have been working on a way to use SD cards for the backups and the FileCopy command is much slower than using Windows Explorer.

I am looking for some alternate command lines that might do the job faster. I would like to know what Explorer is using.

View 8 Replies View Related

Search Folders & Subfolders For Files By Date Modified & Move/Copy Them

Aug 5, 2009

I'm trying to make a macro that will search a folder and move all files from 2008 into another folder. So far it can do this, but what i need is for it to search subfolders also. At this point it moves all files from the main folder, but nothing from the subfolders.

Option Explicit
' Reference site [url]

Sub Copy_and_Rename_To_New_Folder()

Dim objFSO As FileSystemObject
Dim objFolder As Folder
Dim PathExists As Boolean
Dim objFile As File
Dim SrcFolder As String
Dim DestFolder As String
Dim x, Counter As Integer, Overwrite As String, strNewFileName As String
Dim strName As String, strMid As String, strExt As String
Dim LastModYear

View 5 Replies View Related

Convert Multiple Files To Text Files

Sep 26, 2007

I have about 100 Excel files in one folder that need to be saved as text files. They can keep the same name, but simply need to be converted to text files. I'd like to use VBA for this and I can't find examples that do exactly that...or ones that my limited knowledge can handle.

Excel files exist in C:Source and ALL of them should be saved as text files in C:Destination. Maybe there is an easier way, but I thought for sure there was a routine I could use.

View 4 Replies View Related

Move Row To Next Available Row VBA Code?

Mar 7, 2014

I could get a code to move a row from one area of a worksheet to another area on the same worksheet once a cell is tagged "Paid" via a refreshed macro. The updating data table starts on Row 3 for columns "B" - "R." The paid table starts on row 56 where column "B" always has a date in its cell.

View 7 Replies View Related

Move Multiple Columns From Multiple Worksheets Into 1 Column

Aug 18, 2007

I have an excel workbook with 8 worksheets. Each worksheet has vertical columns (approx 250 columns per sheet) of numeric data. Is there a function or macro that will combine all of this data into one vertical column without having to individually cut and paste each one into the new column?

View 3 Replies View Related

VBA Code To Move Row From One Worksheet To Another

Mar 28, 2014

I created a outstanding task worksheet in excel and I would like to move the completed jobs from this sheet to the second worksheet titled 'Completed Tasks'. The first worksheet is called 'Outstanding Tasks'.

I came up with a code to do this (see below). As you can see when I type "Y" into column G it moves the row into the second worksheet. It does this; however it puts it to the bottom of the table on the second worksheet where I would like it to be at the top. I also would like it to delete the row once it has moved it does this but then deletes the other row of information above it leaving blank rows on either side.

I simply want a code that moves the row of information to the second worksheet when I type Y into column G and then delete the row without messing with other information around it.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim rng As Range
Set rng = Target.Parent.Range("G5:G1000")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
Select Case Target.Text
Case "Y"
Target.EntireRow.Cut Sheets("Completed Tasks").Cells(Rows.Count, "A").End(xlUp).Offset(1)
Selection.ListObject.ListRows(1).Delete
End Select
End Sub

View 1 Replies View Related

VB Code - Move Cursor Down 1

Jan 15, 2007

the code to get my cursor to move down 1 row or cell without it actually referencing the chosen cell.

View 9 Replies View Related

Cursor Move Code

Feb 15, 2007

Is there a code to make the Cursor Movement direction to be set to move Left ?

View 2 Replies View Related

Code To Move Active Sheet Tab All The Way To The End (right)?

Dec 10, 2008

I searched and found a couple of different active.sheet codes but could not get it to work. What I want to do is move the worksheet tab I create in the code below all the way to the end (right) of the worksheet tabs already in my workbook.

View 2 Replies View Related

VBA Code For Move To Next Visible Column?

Feb 26, 2014

Right now I am at Column D; From E to I columns are hidden in my worksheet and would like to move to Column J.

View 7 Replies View Related

Move To New Sheet Only When Code Finishes.

Feb 25, 2009

I have a small problem that is more annoying than anything else. I have a command button that opens a userform, and the user can select a value and 'OK'. On 'OK', the code runs, however I would like the sheet 'Information' to remain visible until the code finishes and then switch to 'Task Intervals'. There is also a lot of screen flicker, despite selecting it off/on. I have included an Example file so that you can see the problem.

View 3 Replies View Related

Code To Move Data From One Column To Another?

Oct 12, 2011

coding that will select whatever data is entered in say Coulmn D & then copy it to the botom of another list in Column F.

The amount of rows with data in any of the colums may vary.

View 8 Replies View Related

Code That Will Allow To Move Data From Worksheet?

Mar 17, 2012

I need a code that will allow me to move data from a worksheet to a worksheet from which I came from. e.g. worksheet "Sheet 6" opens "Sheet 10", then after filling data in "Sheet 10" I need to move this data back to "Sheet 6" in the cells in range "F12 to F56". Please note that the data in "Sheet 10" is in the same range as in "Sheet 6"

View 1 Replies View Related

VB Code To Move Rows Up Once Row Above Deleted

Jun 2, 2013

I have this code that removes a group of cells on any row that contains "Y" in Column L, but it does not move the remaining group of cells on a row up after the cells are deleted.

VB code so that when a range of cells are deleted, the row(s) below are moved up?

Sub RemoveReceived()
LastRow = Cells(Rows.Count, "H").End(xlUp).Row 'change "H" to the column that determines which is the last row
For x = LastRow To 4 Step -1 'assuming it starts from row 4
If Cells(x, "L") = "Y" Then
Range("H" & x & ":K" & x).ClearContents ' or use Delete

[Code] ........

View 2 Replies View Related

VBA Code To Move Or Copy Data

May 8, 2009

I would like to copy or move data from one worksheet to another automatically. I have one sheet (Data) with multiple pieces of data for specific individuals. I have several other sheets titled their last name. Can data for example from John Doe be copied to the sheet Doe and data for John Smith be copied to sheet Smith. In essence I would like the sheet to paste everything below John Doe to Doe's sheet and recognize the next name and past that into the next sheet and so on. It may be several different codes, Im ok with that.

One other item all cells do not have data I do need the blank cells copied as well at to not lose the formatting. There is also a blank 2 rows between each person.

If you need a copy of what the data looks like I can send it.

View 9 Replies View Related







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