Results 1 to 2 of 2
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,422
    Thanks
    125
    Thanked 5 Times in 5 Posts

    Macro to open workbooks

    I have the following macro that allows one to select a workbook to open. I would like the macro to be amended so a message box appears once the first workbook has been selected and the data copied, to ask if another file needs to be selected and if yes, then macro to run again , otherwise the macro must end




    Code:
     Sub Open_Workbook()
        
        Dim A     As Variant
        
        ChDir "C:\My Documents"
        A = Application.GetOpenFilename
        If A = False Or IsEmpty(A) Then Exit Sub
        
        Application.ScreenUpdating = False
        
        With Workbooks.Open(A)
            With .Sheets("Imported Data")
                .Range("Q2", .Range("R" & Rows.Count).End(xlUp)).Copy _
                    Destination:=ThisWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1)
            End With
            .Close SaveChanges:=False
        End With
        
        Application.ScreenUpdating = True
        
    End Sub
    I have also posted on Mr Excel.com


    http://www.mrexcel.com/forum/excel-q...oo-s-open.html

  2. #2
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,422
    Thanks
    125
    Thanked 5 Times in 5 Posts
    Have received solution MrExcel.com

    http://www.mrexcel.com/forum/excel-q...ml#post4119502

Posting Permissions

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