Consulting

Results 1 to 2 of 2

Thread: Automatically choose which file to open?

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    52
    Location

    Automatically choose which file to open?

    Hi All,

    I have an issue and do not how to code that in VBA.

    Basically on daily base I have to update data in Workbook "Daily", Sheet1, Sheet2, Sheet3 and Sheet4. I retreive data from several csv files - named for example DataVendor1.csv, copy it and paste it to a particular tab (Sheet1, Sheet2 etc..). These csv files are generated in the night and uploaded by 3rd party datavendors. So far no problem - my codes work.

    Since processes has changed, I have to retreive the same data from the same csv files with the difference that on the months Jan, Mar, May, Jul, Sep and Nov the file name is called DataVendor1_EV.csv and on the other months it has the normal name "DataVendor1.csv".

    Question: How can I code VBA in a way that it will automatically choose the correct one. The content, format and ranges are exact the same. Only the file name differs.

    I hope I described my issue clearly and that someone can help me.

    Thanks in advance,

    Riaaz66

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Why not post your existing code for amendment?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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