+ Reply to Thread
Results 1 to 4 of 4

Macro to pull from a list of multiple CSV and automatic import to field.

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Eden Prairie, MN
    MS-Off Ver
    Excel 2010
    Posts
    7

    Macro to pull from a list of multiple CSV and automatic import to field.

    Hello,

    This is my first time on this site and I am hoping someone can help me. Here is my problem...

    I have multiple CSV's stored on my computer (c:/desktop/Tech Folder). I would like the option to select a CSV from a drop down box (cell A1). I was thinking that maybe this cell could automatically refresh when a CSV is transferred to this comunity folder of all my CSV reports.

    Afterwards, Once this CSV is selected I would like a macro (ctrl + shift + Q) to input that in cell C6. (CSV: delimited, comma, begin with row 6, remove last column) Once this is entered the graphs will automatically generate.

    Bonus points if anyone knows how automatically scale a graph to the data points listed in the table (smaller graph for smaller data points, larger graphs for larger datapoints)


    Here is what I have so far for my import macro, but it only imports the one CSV I specify.

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+Q
    '
    With ActiveSheet.QueryTables.Add(Connection:= _
    "TEXT;C:\Users\MYNAME\Desktop\Tech Folder\UPSCF0.CSV", Destination:= _
    Range("$C$14"))
    .Name = "UPSCF0"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = False
    .RefreshPeriod = 0
    .TextFilePromptOnRefresh = False
    .TextFilePlatform = 437
    .TextFileStartRow = 6
    .TextFileParseType = xlDelimited
    .TextFileTextQualifier = xlTextQualifierDoubleQuote
    .TextFileConsecutiveDelimiter = False
    .TextFileTabDelimiter = False
    .TextFileSemicolonDelimiter = False
    .TextFileCommaDelimiter = True
    .TextFileSpaceDelimiter = False
    .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1)
    .TextFileTrailingMinusNumbers = True
    .Refresh BackgroundQuery:=False
    End With
    ActiveWorkbook.Save

    End Sub


    Much gratitude to all who attempt this problem!


    Chris
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Macro to pull from a list of multiple CSV and automatic import to field.

    The post violates the Forum Rules
    Click on star (*) below if this helps

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    Eden Prairie, MN
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Macro to pull from a list of multiple CSV and automatic import to field.

    How am I violating any rules?

  4. #4
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Macro to pull from a list of multiple CSV and automatic import to field.

    Code needs to within code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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