![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
This might be difficult, at least it is for me.
I have a macro that opens a data source c:data1.txt and formats the data. The problem is that everyday I have to rename the data source to data1.txt. Is there a way the macro can open the newest data file? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
not quite sure what your asking here are you wanting to open data1 each day then save it as data1? can you explain more>
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
I would like it to open the newest report with the word "data" in the begining.
ex. data3.txt created 4/1 data5.txt created 4/6 data8.txt created 4/8 The macro would open the newest one, being data8.txt I hope this helps. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
I could think of 1 with an input box and you could just enter 8 into it and it would open data8.xls would that help
would the number keep growing 9 , 10 , 11 etc |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
Thats a good idea but I would want it to run automatically. Without me typing anything.
Just thought someone out there might have had an answer to this problem. Thanks |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
for example
Sub wkbopen() Dim num As Long num = CLng(InputBox("Enter Data Number")) Workbooks.Open Filename:="C:Data" & (num) & ".txt" End Sub [ This Message was edited by: brettvba on 2002-04-29 17:03 ] |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,512
|
Well. If you don't need to keep those other txt files after you're done you can add this to the end of your macro:
kill c:mypathdata1.txt
__________________
~Anne Troy |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|