PDA

View Full Version : Automatically choose which file to open?



Riaaz66
01-11-2012, 09:15 AM
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

mdmackillop
01-11-2012, 10:58 AM
Why not post your existing code for amendment?