Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Cycle through Variables

Hello,
I am trying to think of a way that I could loop through a range of defined
variables. Perhaps I am approaching this the wrong way so any suggestions
would be greatly appreciated. Basically what I am trying to do is shown
below.

Thanks in advance!
'****
Dim SourceFile As String, SourcePath As String, sFile As String
Dim DestFile As String, DestPath As String, dFile As String
Dim r As Long

SourcePath = "I:\"
DestPath = "C:\"

fname1 = "RS_2626(Z)_1YR.pdf"
fname2 = "RS_2626(Z)_2YR.pdf"
fname3 = "RS_2626(Z)_3YR.pdf"
fname4 = "RS_2626(Z)_4YR.pdf"
fname5 = "RS_4501(Z)_1YR.pdf"
fname6 = "RS_4501(Z)_2YR.pdf"
fname7 = "RS_4501(Z)_3YR.pdf"

'****Loop file names to File Var

For r = 1 To 7 Step 1

sFile = fname & r

'*****Copy File **********
SourceFile = SourcePath & sFile
DestFile = DestPath & sFile

FileCopy SourceFile, DestFile
'****End Copy *********

Next r

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
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Charts and Charting in Excel 1 December 17th 09 03:03 AM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
Time Cycle Antonio Excel Discussion (Misc queries) 7 December 3rd 07 11:01 PM
Rota cycle Steve Excel Programming 2 March 12th 07 09:36 PM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM


All times are GMT +1. The time now is 10:46 AM.

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

About Us

"It's about Microsoft Excel"