Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Data Source Changes

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #6
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #7
    MrExcel MVP Anne Troy's Avatar
    Join Date
    Feb 2002
    Location
    Westwood NJ
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •