PC Review


Reply
Thread Tools Rate Thread

Amend sub to read from names in col A

 
 
Max
Guest
Posts: n/a
 
      25th Apr 2008
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


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      25th Apr 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      25th Apr 2008
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" <(E-Mail Removed)> wrote in message
news:Op$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      25th Apr 2008
Many thanks, Bob.
That did it well.

Max


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Won't Read Cell Names krum35 Microsoft Excel Misc 1 20th Dec 2008 10:34 PM
how to read names of recipients in the to box Tulasi Microsoft Outlook Form Programming 1 4th Jan 2008 01:44 PM
Insufficient pemissions to amend Excel files but can amend Word fi =?Utf-8?B?RiBMYXVmcw==?= Microsoft Windows 2000 Security 0 11th Oct 2006 12:28 PM
q; read file names =?Utf-8?B?SklNLkgu?= Microsoft ASP .NET 2 16th Sep 2006 02:12 PM
How to amend and edit a read only email attachment on word =?Utf-8?B?Z2VycnkgUHJpdGNoYXJk?= Microsoft Word Document Management 1 19th Aug 2005 05:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:21 AM.