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?
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