tell me the easiest way to merge import data into excel sheet with multiple matching columns?

OK, so i figured it out. Rather than trying to import it and it stuff up (encapsulated comma’s aplenty) I decided to open in the background and copy worksheet into current workbook.

Like this….

Sub IMPORT_MONTH()

    Dim fileName As Variant

    'open dialogue box to get new file to import
    fileName = Application.GetOpenFilename
            
    If fileName = False Then
        MsgBox ("Why did you click cancel?")
        Exit Sub
    End If
            
    On Error GoTo ErrHandler
    
    ' run update in background
    Application.ScreenUpdating = False

    Set closedBook = Workbooks.Open(fileName)
    closedBook.Sheets(1).Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
    closedBook.Close SaveChanges:=False

    Application.ScreenUpdating = True
    
    'move cursor to home for ease of readability
    ActiveSheet.Range("A1").Select
    
Exit Sub

ErrHandler:
    MsgBox ("It Broke")

End Sub

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top