Consulting

Results 1 to 2 of 2

Thread: Help converting Macro to be compatible with Mac

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Oct 2019
    Posts
    1
    Location

    Help converting Macro to be compatible with Mac

    Hello! I have a client that is using Macs to run the macro below and I am having trouble converting it. At solutions?

    SubMergeExcelFiles()
        Dim fnameList, fnameCurFile As Variant
        Dim countFiles, countSheets As Integer
        Dim wksCurSheet As Worksheet
        Dim wbkCurBook, wbkSrcBook As Workbook
        fnameList =Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks(*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excelfiles to merge", MultiSelect:=True)
        If (vbBoolean <> VarType(fnameList)) Then
            If (UBound(fnameList) > 0) Then
                countFiles =0
                countSheets= 0
                Application.ScreenUpdating = False
                Application.Calculation = xlCalculationManual
                SetwbkCurBook = ActiveWorkbook
                For EachfnameCurFile In fnameList
                    countFiles = countFiles + 1
                    Set wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)
                    For Each wksCurSheet In wbkSrcBook.Sheets
                        countSheets = countSheets + 1
                        wksCurSheet.Copy after:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                    Next
                    wbkSrcBook.Close SaveChanges:=False
                Next
                Application.ScreenUpdating = True
                Application.Calculation = xlCalculationAutomatic
               MsgBox"Processed " & countFiles & " files" & vbCrLf& "Merged " & countSheets & " worksheets",Title:="Merge Excel files"
           End If
        Else
            MsgBox "No files selected", Title:="Merge Excel files"
        End If
    End Sub
    Last edited by Aussiebear; 03-19-2025 at 05:48 PM.

Posting Permissions

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