Macro working on one computer but not another?

TheDoctor

New Member
Joined
Apr 13, 2012
Messages
3
Hi,

I've got a macro as below that works fine on one computer but when running on another computer (that are using the same version of excel with seemingly the same settings) it produces deletes extra rows within a table and proceeds to paste data outside of the table range.

Any ideas?

Code:
Sub MainMacro()




Application.ScreenUpdating = False


    Sheets("Copy").Visible = True
    Sheets("Copy").Select
   
    
    Range("Table2").Select
    ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=37, Criteria1:= _
        "Y"
    ActiveSheet.ShowAllData
    Range("B4:AK4").Select
    Range(Selection, Selection.End(xlDown)).Select
 Selection.EntireRow.Delete
   
    
    Sheets("Main Report").Select
    Range("Table4").Select
    Range("B5:AK5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    
    Sheets("Copy").Select
    Range("Table2").Select
    Range("B4").Select
    ActiveSheet.Paste
    
    Sheets("Main Report").Select
    Range("Table4").Select
   Range("B5:AK5").Select
    Range(Selection, Selection.End(xlDown)).Select
 Selection.EntireRow.Delete


    
    Sheets("Copy").Select
    




      ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=37, Criteria1:= _
        "N"
    Range("Table2").Select
    Selection.Copy
    Sheets("Main Report").Select
    Range("Table4[Container Number]").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False






    Sheets("Paste Data Here").Select
    Worksheets("Paste Data Here").Range(Range("A2:AJ2"), Range("A3:J3").End(xlDown)).Copy
    Sheets("Main Report").Select
    
    Worksheets("Main Report").Range("B5").End(xlDown).Offset(1).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
        Range("Table4").Select
    Range("G13").Activate
    ActiveWorkbook.Worksheets("Main Report").ListObjects("Table4").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("Main Report").ListObjects("Table4").Sort.SortFields. _
        Add Key:=Range("Table4[ETD Vessel]"), SortOn:=xlSortOnValues, Order:= _
        xlAscending, CustomOrder:="Mon,Tue,Wed,Thu,Fri,Sat,Sun", DataOption:= _
        xlSortTextAsNumbers
    With ActiveWorkbook.Worksheets("Main Report").ListObjects("Table4").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    
    Sheets("Copy").Visible = False
    
    Application.ScreenUpdating = True
    
    
    
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Honestly I have not gone through the code in detail but check if there are any relative referencing / absolute referencing issues
Also whether the referencing style is the same i.e. R1C1 on both apps
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,270
Members
449,149
Latest member
mwdbActuary

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