Excel for MAC is crashing

excelpunk

Board Regular
Joined
May 6, 2011
Messages
165
Hello All,

I am trying to fix the following macro which I am trying to execute in MAC. It works/loops for sometime and then excel gets closed. My code below:

Code:
Set wb = ActiveWorkbook
Set ws = Sheet1
a = Sheet4.Cells(Rows.Count, "A").End(xlUp).Row
If a > 1 Then
    For b = 2 To a
        c = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row + 1
        
        Workbooks.Open (Sheet4.Cells(b, "A").Value)
        Set wbb = ActiveWorkbook
        Set sh = wbb.ActiveSheet
        bb = sh.Cells(Rows.Count, "A").End(xlUp).Row
        
        wb.Activate
        ws.Select
      
        Range(Cells(c, 2), Cells(c + bb - 1, 4)).Value = Workbooks(wbb.Name).Worksheets(sh.Name).Range("A1:C" & bb).Value
        wbb.Close savechanges:=False
        
        Set sh = Nothing
        Set wbb = Nothing
        
        d = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row
        Sheet1.Range(Cells(c, "A"), Cells(d, "A")) = Replace(Sheet4.Cells(b, "B").Value, ".txt", "")
    Next
End If
Application.CutCopyMode = False
ActiveWorkbook.Save
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top