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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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