Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recognize that this is not truly an Excel thing but it's where the data
lives so I would like to continue to use Excel. I have a column that contains a filename and another column that contains a path. I would like to either rename all the files that exist in a specific folder OR copy the files from source path to target path. The data is structured below. The source/target path can be split if I need to as in drive letter versus a path, etc... I would prefer the macro to cascade down one row at a time once the file has been copied. If the copy command is difficult then I can just have them renamed and then I can do a manual copy. Column A(Filename) B(Source) C(target) file123.pdf c:\jason u:\archive file222.txt c:\jason u:\archive |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
Sub MyMacro() Dim lngRow As Long For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row FileCopy Range("B" & lngRow) & "\" & Range("A" & lngRow), _ Range("C" & lngRow) & "\" & Range("A" & lngRow) Next End Sub If this post helps click Yes --------------- Jacob Skaria "Rookie_User" wrote: I recognize that this is not truly an Excel thing but it's where the data lives so I would like to continue to use Excel. I have a column that contains a filename and another column that contains a path. I would like to either rename all the files that exist in a specific folder OR copy the files from source path to target path. The data is structured below. The source/target path can be split if I need to as in drive letter versus a path, etc... I would prefer the macro to cascade down one row at a time once the file has been copied. If the copy command is difficult then I can just have them renamed and then I can do a manual copy. Column A(Filename) B(Source) C(target) file123.pdf c:\jason u:\archive file222.txt c:\jason u:\archive |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It works perfectly to what I asked but I believe I left a part out. I
appreciate what you wrote but I also either need to delete the file after it's moved OR rename it after it's moved so I can then delete it later. Sorry for missing that in the first place. "Jacob Skaria" wrote: Try Sub MyMacro() Dim lngRow As Long For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row FileCopy Range("B" & lngRow) & "\" & Range("A" & lngRow), _ Range("C" & lngRow) & "\" & Range("A" & lngRow) Next End Sub If this post helps click Yes --------------- Jacob Skaria "Rookie_User" wrote: I recognize that this is not truly an Excel thing but it's where the data lives so I would like to continue to use Excel. I have a column that contains a filename and another column that contains a path. I would like to either rename all the files that exist in a specific folder OR copy the files from source path to target path. The data is structured below. The source/target path can be split if I need to as in drive letter versus a path, etc... I would prefer the macro to cascade down one row at a time once the file has been copied. If the copy command is difficult then I can just have them renamed and then I can do a manual copy. Column A(Filename) B(Source) C(target) file123.pdf c:\jason u:\archive file222.txt c:\jason u:\archive |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I made a mistake in my initial request could you review it again.
"Jacob Skaria" wrote: Try Sub MyMacro() Dim lngRow As Long For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row FileCopy Range("B" & lngRow) & "\" & Range("A" & lngRow), _ Range("C" & lngRow) & "\" & Range("A" & lngRow) Next End Sub If this post helps click Yes --------------- Jacob Skaria "Rookie_User" wrote: I recognize that this is not truly an Excel thing but it's where the data lives so I would like to continue to use Excel. I have a column that contains a filename and another column that contains a path. I would like to either rename all the files that exist in a specific folder OR copy the files from source path to target path. The data is structured below. The source/target path can be split if I need to as in drive letter versus a path, etc... I would prefer the macro to cascade down one row at a time once the file has been copied. If the copy command is difficult then I can just have them renamed and then I can do a manual copy. Column A(Filename) B(Source) C(target) file123.pdf c:\jason u:\archive file222.txt c:\jason u:\archive |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get a file not found, even when the file is there. I added a watch
expression and they both look correct - however I am not sure why on the target folder you adding the file name to. I assumed it would be just a source and target folder. "Jacob Skaria" wrote: Try Sub MyMacro() Dim lngRow As Long For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row FileCopy Range("B" & lngRow) & "\" & Range("A" & lngRow), _ Range("C" & lngRow) & "\" & Range("A" & lngRow) Next End Sub If this post helps click Yes --------------- Jacob Skaria "Rookie_User" wrote: I recognize that this is not truly an Excel thing but it's where the data lives so I would like to continue to use Excel. I have a column that contains a filename and another column that contains a path. I would like to either rename all the files that exist in a specific folder OR copy the files from source path to target path. The data is structured below. The source/target path can be split if I need to as in drive letter versus a path, etc... I would prefer the macro to cascade down one row at a time once the file has been copied. If the copy command is difficult then I can just have them renamed and then I can do a manual copy. Column A(Filename) B(Source) C(target) file123.pdf c:\jason u:\archive file222.txt c:\jason u:\archive |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Function based on multiple criteria from two cell references | Excel Worksheet Functions | |||
Macro for saving files where title is made from cell references | Excel Discussion (Misc queries) | |||
Cell References Between sheets or Files Not Working | Excel Discussion (Misc queries) | |||
Display cell based on multiple cross-references | Excel Worksheet Functions | |||
Moving rows from one sheet to another based on a particular cell v | Excel Discussion (Misc queries) |