Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Amend sub to read from names in col A

Sub CopynReNameFiles()
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx1.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx2.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx3.xls"
'etc etc
End Sub

How could the above sub be amended to loop through
& read-in/use all the destination file names, ie:

Dxx1
Dxx2
Dxx3
etc, etc

from the list of 100+ names
that's already placed in col A in the active sheet?

Thanks for insights


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Amend sub to read from names in col A

Sub CopynReNameFiles()
Dim LastRow As Long
Dim i As Long

With ACtiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow

FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\" & .Cells(iI,
"A").Value & ".xls"
Next i
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Max" wrote in message
...
Sub CopynReNameFiles()
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx1.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx2.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx3.xls"
'etc etc
End Sub

How could the above sub be amended to loop through
& read-in/use all the destination file names, ie:

Dxx1
Dxx2
Dxx3
etc, etc

from the list of 100+ names
that's already placed in col A in the active sheet?

Thanks for insights



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Amend sub to read from names in col A

Sorry, typo

Sub CopynReNameFiles()
Dim LastRow As Long
Dim i As Long

With ACtiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow

FileCopy "D:\Max\DBrT.xls", _
"D:\Max\DBrT\" & .Cells(i, "A").Value & ".xls"
Next i
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Bob Phillips" wrote in message
...
Sub CopynReNameFiles()
Dim LastRow As Long
Dim i As Long

With ACtiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow

FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\" & .Cells(iI,
"A").Value & ".xls"
Next i
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Max" wrote in message
...
Sub CopynReNameFiles()
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx1.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx2.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx3.xls"
'etc etc
End Sub

How could the above sub be amended to loop through
& read-in/use all the destination file names, ie:

Dxx1
Dxx2
Dxx3
etc, etc

from the list of 100+ names
that's already placed in col A in the active sheet?

Thanks for insights





  #4   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Amend sub to read from names in col A

Many thanks, Bob.
That did it well.

Max


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Won't Read Cell Names krum35 Excel Discussion (Misc queries) 1 December 20th 08 10:34 PM
amend formula [email protected] Excel Discussion (Misc queries) 1 August 20th 08 05:02 AM
Amend SQL Query with VBA mr tom Excel Programming 7 April 3rd 07 03:36 PM
How to amend formula ? moonhk Excel Programming 2 December 4th 06 05:50 AM
read a column of names and place a number in the next cell Judy Hallinan Excel Discussion (Misc queries) 1 December 7th 05 11:48 PM


All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"