+ Reply to Thread
Results 1 to 1 of 1

Macro to import from CSV as Query instead of just data

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    11

    Macro to import from CSV as Query instead of just data

    I have the following Macros to select multiple files and import them into workbooks.

    Once the data is imported I then label the tab based on part of the filename and then run multiple processes to cleanup the data then save each file with a filename based on date and time. I've removed those lines as they are't relevant to the part I'm struggling with.

    I left in the Lattitude and Longitude calculations to show the way I search the top row for the header I want and then use that as a reference for the following calculations.

    If there is a more elegant way to find the column I want and process the calculation based on that I'd be happy to hear it. The way I've done it seems a bit messy, but I can't think of a better way.

    I've attached a workbook with 2 tabs. One with 10 lines as a table, the other as a normal data import.

    Please Login or Register  to view this content.

    What I'd really like to do is import the data as a query. That way I can use references such as @[Lon_2M] and @[Lon_2L] which makes it much easier to work with. However I have no idea how to incorporate a Table Query import into the macro I have.

    I recorded the query import process which is below, but as you can see it hardcodes the filename into the macro instead of my `fname` variable used in the first one.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel Query to Import Data From Web
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2018, 07:53 AM
  2. Macro and web query/import
    By cbrooks in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2010, 12:21 PM
  3. Macro to Refresh Import Query
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2009, 03:57 AM
  4. Macro to run Ms Query and import the data into excel
    By aryans1in in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2008, 09:02 PM
  5. import data without query
    By dvnmaya in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2006, 02:35 PM
  6. [SOLVED] new web query ( import data )
    By Josh in forum Excel General
    Replies: 0
    Last Post: 01-17-2006, 10:55 PM
  7. import web query data from web
    By John W in forum Excel General
    Replies: 0
    Last Post: 02-24-2005, 02:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1