Results 1 to 4 of 4

Help with Compiling Excel Spreadsheet Data into One Table

Threaded View

excelatlife Help with Compiling Excel... 08-20-2012, 03:40 PM
Mordred Re: Help with Compiling Excel... 08-20-2012, 04:14 PM
watersev Re: Help with Compiling Excel... 08-20-2012, 04:44 PM
Cutter Re: Help with Compiling Excel... 08-20-2012, 07:50 PM
  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Help with Compiling Excel Spreadsheet Data into One Table

    Hi everyone, having trouble with one line of code. I think I'm pretty close to figuring out this macro. I'm getting the following error:
    "Run-time error '438':
    Object doesn't support this property or method"
    on this line of code: wbMstr.wsMstr.Range("c1").End(xlDown).Offset(1, 0).Select

    How can I better define my method? Thanks!


    Sub ImportCSVsWithReference()
    
    'Summary:   Import all CSV files from a folder into a single sheet
    '           adding a field in column A listing the CSV filenames
    
    Dim wbCSV   As Workbook
    Dim wbMstr  As Workbook:    Set wbMstr = ThisWorkbook
    Dim wsMstr  As Worksheet:   Set wsMstr = ThisWorkbook.Sheets("Sheet1")
    Dim fPath   As String:      fPath = "C:\Users\Eddie\Dropbox\Admob pull Data\Admob pull Data(eddie)\8.17\"    'path to CSV files, include the final \
    Dim fCSV    As String
    
    'If MsgBox("Clear the existing MasterCSV sheet before importing?", vbYesNo, "Clear?") _
        '= vbYes Then wsMstr.UsedRange.Clear
    
    Application.ScreenUpdating = True  'speed up macro
    
    fCSV = Dir(fPath & "*.csv")         'start the CSV file listing
    
        Do While Len(fCSV) > 0
          'open a CSV file
            Set wbCSV = Workbooks.Open(fPath & fCSV)
            wbCSV.ActiveSheet.Range(Range("a3:h3"), Range("a3").End(xlDown)).Copy
            wbMstr.wsMstr.Range("c1").End(xlDown).Offset(1, 0).Select
            
            wbCSV.Close False
          'ready next CSV
            fCSV = Dir
        Loop
     
    Application.ScreenUpdating = True
    End Sub
    Last edited by Cutter; 08-20-2012 at 07:50 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

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