Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Routine Only opens every other file in Excel 1

Status
Not open for further replies.

OzzieTheOwl

Technical User
Jun 26, 2006
61
GB
Hi

I have the following code which is supposed to open up every Excel file in a directory, but it only appears to open up every other file.

Can anyone see what I have done wrong?

Code:
    Dim myFiles
    myFiles = Dir("\\bbuukvirfnp0001\scm\logistics\Costing data\Stock Values " & YearNo & "\Week " & WeekNo & "\*.xls")
    Do While Dir <> ""
        Workbooks.Open Filename:="\\bbuukvirfnp0001\scm\logistics\Costing data\Stock Values " & YearNo & "\Week " & WeekNo & "\" & myFiles
        myFiles = Dir
    Loop

Cheers

Barney
 
Do While [!]myFiles[/!] <> ""

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV

Thanks mate, helpful as ever.
I thought it must be something simple I had missed.

Cheers

Barney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top