Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Opening Files Using VBA

I have a named range (FilesToOpen) that contains a variable number of
filenames and path (i.e. c:\mydoc\text.xls) that need to be opened
(range FileCount contains number of files).

What I want to do is have a macro that opens all the files in
FilesToOpen range, calculates the original sheet, and then close the
files opened by the macro.

I've been trying with For and Next and open file Range etc. but am
strugling with the syntax. Any help appreciated. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Opening Files Using VBA


Uzytkownik napisal w wiadomosci
ups.com...
I have a named range (FilesToOpen) that contains a variable number of
filenames and path (i.e. c:\mydoc\text.xls) that need to be opened
(range FileCount contains number of files).

What I want to do is have a macro that opens all the files in
FilesToOpen range, calculates the original sheet, and then close the
files opened by the macro.

I've been trying with For and Next and open file Range etc. but am
strugling with the syntax. Any help appreciated. Thanks.


Sub test()
Dim filename As String
For Each cell In Range("a1:a2")
filename= "c:\" & cell.Value & ".xls"
Workbooks.Open Filename:=filename
.....
...


Next filename
End Sub

hope this help
mcg


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
show most recent files first when opening excel files Anne` Excel Discussion (Misc queries) 5 January 23rd 08 01:54 AM
Opening Quattro Pro for Windows files (*.WB1 Files) using Excel 20 PoundMutt Excel Discussion (Misc queries) 1 June 20th 07 03:50 AM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM
Opening Files Dave[_32_] Excel Programming 2 October 16th 03 06:25 PM
Opening files Dan E[_2_] Excel Programming 0 August 13th 03 10:23 PM


All times are GMT +1. The time now is 04:29 PM.

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"