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
ADVERTISEMENT
Aug 1, 2014
I have a macro that works just find on my local machine. but it need to run from a network drive as several different people may need to access it.
A brief description of the macro.
The macro looks in an directory called unprocessed for any file named "*.csv" if the files are found it opens the file in excel and then copies data from that workbook to my workbook. after this the .csv file is closed (unchanged) and then it is moved to the processed directory.
Sub files()
Dim directory As String, filename As String, sheet As Worksheet, i As Integer, j As Integer
Dim filetype As String
Application.ScreenUpdating = False
[Code].....
View 7 Replies
View Related
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
Jul 14, 2014
Scenario; I have 3rd party software that pulls reports in .csv files. I want to summarise this data into another spread sheet. Ideally I would like to save these files into a folder on the network and my summary workbook simply looks for this folder and is able to find data within all Excel files saved in there (new files will be added on a monthly basis).
Once it has found the folder there will be 2 pieces of data to evaluate; Cell $B$1; this will be the name of a course (e.g. health & safety, money laundering etc.) Column $D; this will contain the score achieved by multiple learners.
The summary spreadsheet then averages all of the scores for the different courses(in seperate cells)
The idea is that the .csv files can be pulled and saved into said folder and eliminates the need to manually input this data into the summary spreadsheet.
View 7 Replies
View Related
Jan 20, 2007
I wrote a macro that runs perfect when started from my pc, but if started from a different ps which is logged into the same network it doesn't run, also the macro is stored on the server. I have a code in the private section of the workbook:
Private Sub Workbook_Open()
Call FINAL
End Sub
then the macro 'FINAL' is stored in the 'Modules' section and starts with:
Sub FINAL()
'this part opens the Edit/Links dialog from which the user has to choose the relevant model
Dim Which_financial_model_contains_the_data As String
ActiveWorkbook.ChangeLink Name:= _
"T:DEALSSSalsa (Project)Financial modelsProject Salsa Model - BASED ON SPONSOR CASE - b - 20061214.xls" _
, NewName:= _
"Which_financial_model_contains_the_data" _
, Type:=xlExcelLinks
View 6 Replies
View Related
Jan 26, 2010
I currently have the following ...
View 8 Replies
View Related
Aug 10, 2007
In my macro I need to open to paths. the 1st path I I have working. Here is the
Dim OpenA As Workbook, OpenB As Workbook
Dim TheFile As String
Dim TheFile2 As String
ChDrive "H:"
ChDir "H:Treasury Project"
TheFile = Application. GetOpenFilename("Excel Files (*.xls), *.xls", , "Select the file and choose open.")
If TheFile = "False" Then
Exit Sub
End If ...............
The "????" are where I don't know what to do. I used a test path to make sure all code works and it does, but the real path is a network location. When I go to it manually with excel this is where it shows me to have gone: My Net Work Places, Entire Network, Microsoft Windows Network, Company2, datawhse, root, LAW81, Lawson, Print, Name. If I open a file and do =cell("filename") it gives me \datawhse
ootLAW81LAWSONprintNameanrvwfins111thSSFRPMOEDTL.csv. Is it possible to get excel to open me up to ...\datawhse ootLAW81LAWSONprintName.
View 6 Replies
View Related
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
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
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
Jan 5, 2014
I am an extreme novice to using macros.
I used the 'record macro' feature to create the following: I created a rectangle box on sheet1 of NEW TEST.xlsm to link to the macros incidated below. Niether macro moves on after reaching the Workbooks.Open statement.
I am at a loss. Is there something in Excel that needs to be set? Is there something else that I need to do version of Excel is 14.0.6129.5000 (32 bit) MS Office Professional Plus 2010
What I am trying to accomplish is this: From 'NEW TEST.xlsm', open an excel file on the network, add a new sheet to this network file, calling it 'Pivot'. Then create a pivot table in this new sheet from the data in sheet data1 of this same network file. Then move control of macro / processing back to the NEW TEST file. Eventually I will do more, but for starters, I cannot even get the macro to add / name a new sheet in the network file.
[SIZE=3][COLOR=#000000][FONT=Arial]PS I have attached the NEW TEST.xlsm fikle as we as the data file. NOTE: the data file has been reduced to one day's worth of data, to to the upload file size.Also, my Excel Trustred locations has "Allow trusted locations on my network" checked, and the network location to the data file in trusted user locations.
VB:
Sub Open_Add_Sheet()
Dim filename, filelocation As String
Dim wb As Workbook
filename = "11 Nov, 2013 GDO AHS Agent Productivity Report.xls"
filelocation = "R:acharukAHS ReportsGDOGDO CSR ACTIVITY Report2013" & filename
Set wb = Workbooks.Open(filelocation) '
' Open_Add_Sheet Macro
[Code]....
View 9 Replies
View Related
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
View Related
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
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
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
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
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
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
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
Oct 3, 2012
I have a macro which refreshes a query when the spreadsheet is opened. This works fine when online.
However, if the user is not online, the query is unable to refresh and the macro just hangs.
Is there a code which will enable me to say " if unable to refresh then move on to the next line"?
here's the code below.
Private Sub Workbook_Open()
Sheets("Houselist").Activate
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Front").Select
Range("A1").Select
End Sub
View 2 Replies
View Related
Apr 25, 2007
i need to make a macro that takes workbooks or files and
runs them through another macro. i already have the 2nd macro
done and it is working perfectly i just need to know how to make the one
that finds the other files and runs them all through the macro i already made. My boss said that he will have about 150-200 files to run through this macro.
View 9 Replies
View Related
Apr 4, 2014
I have a work book with 6 worksheets, sheet2 is called Maersk, sheet3 Mariana, and so on ....
I need a macro so when I type Mariana in sheet1 g20 and hit enter it go's to Mariana sheet .....
View 5 Replies
View Related
Mar 26, 2014
I have a macro that is auto opening a form to be completed, but it currently opens on the first row of data that has been inputted.
How do I get the macro to move to a new row immediately to stop people from over-typing the first row of data?
View 5 Replies
View Related
May 14, 2009
I need a macro that I can assign to a button so that it will jump the screen to a particular cell. I want it to select the cell in a chosen column in the same row as the cursor already was. So, if I'm in M10 and I hit the AK button, it'll jump to AK10. If I'm in F54 and I hit the AK button it'll jump to AK54.
View 2 Replies
View Related
Oct 14, 2009
I am trying to create a macro to do the following (Microsoft Excel 2002 SP3):
1 - Select the text from the active/selected cell (i.e. B1)
2 - Cut the text from B1
3 - Move to the cell directly above the active/selected cell (i.e. A1)
4 - Add a space to the end of whatever text is in A1
5 - Paste the contents that were cut from B1 after the text and space in A1
6 - Delete the row where the text was cut from (i.e. entire row B)
I have never written code for macro's before, only done recording, but just can't seem to get this sequence to work .
View 8 Replies
View Related
Feb 22, 2010
I've used the macro recorder to copy a cut and paste routine, but it won't play back correctly. Here's the macro I recorded:
View 7 Replies
View Related
Nov 2, 2011
I need to cut 2 rows when i put "V" in E column, and then to paste them below row that have in column A, "OLD".
Ex:
I have many rows with data like this:
.......A..........B.........C.......D......E
1...subject
2...notes
3...subject............................."V"
4...notes
5...subject
6...notes
...
25..."old" row...............................
I need to cut the row with "V" in column E and the below row, and paste them below row with "old" in A column, like this:
.......A..........B.........C.......D......E
1...subject
2...notes
3...subject
4...notes
...
23..."old" row...............................
24...subject............................."V"
25...notes
View 9 Replies
View Related
Dec 19, 2013
I've been using the record macro function to accomplish a lot of my formatting tasks for my work reports.
I'm running into a snag that I'm not sure how to fix. Essentially I want the program to recognized the term "Grand Total" and the cell to the right of it. Then I want those two cells to be moved to the far left.
The # of rows will continuously change but he column shouldn't change.
I've tried naming the cell selection to have it moved but I can't seem to make it work.
When I use the record macro function and do a CTRL F search for "grand total", excel doesn't seem to recognize that I want that cell and the cell to the right to be the ones to move. Instead, whatever row of cells I create the macro with, it wants to duplicate the move with the same exact cell.
View 2 Replies
View Related
May 14, 2008
I have a piece of my macro that creates a chart on the second sheet in my workbook.
However, it tends to appear way off to the right, and then I have to readjust it every time to be where I'm working (columns A-D approx.)
Can I improve the move to specify it to place the graph in a certain
All I'm currently doing is:
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet2"
View 9 Replies
View Related
Jul 23, 2008
I have about 80 sheets in a workbook, and I would like to put each sheet into it's own workbook, and have that new workbook called by the value in Column A.
View 9 Replies
View Related