Rkhandelwal1988
New Member
- Joined
- Jun 4, 2015
- Messages
- 3
i have below macro which i recorded in windows and working perfectly fine. But when my client is trying to use it from MAC, it doesnt work. Showing error message "Run-time error "1004" Aplication defined or obeject defined error".
Please let me know why this is happening and what can i do to make it work.
Thanks !Sub Macro1()
Application.DisplayAlerts = False
Range("A1:A301").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
"(", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("B1:B301").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
")", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("i1:i301").Select
Selection.TextToColumns Destination:=Range("i1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
"(", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("j1:j301").Select
Selection.TextToColumns Destination:=Range("j1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
")", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Sheet3.Select
Range("S2:V301").Select
Selection.Copy
Sheet1.Select
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheet1.Range("C5:D304").Select
With Selection
Selection.NumberFormat = "General"
.Value = .Value
End With
Sheet1.Range("A4:D304").Select
ActiveWorkbook.Worksheets("Output").Sort.SortFields.clear
ActiveWorkbook.Worksheets("Output").Sort.SortFields.Add Key:=Range("C5:C304") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("output").Sort
.SetRange Range("A4:D304")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.DisplayAlerts = True
End Sub
Please let me know why this is happening and what can i do to make it work.
Thanks !Sub Macro1()
Application.DisplayAlerts = False
Range("A1:A301").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
"(", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("B1:B301").Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
")", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("i1:i301").Select
Selection.TextToColumns Destination:=Range("i1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
"(", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Range("j1:j301").Select
Selection.TextToColumns Destination:=Range("j1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:= _
")", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Sheet3.Select
Range("S2:V301").Select
Selection.Copy
Sheet1.Select
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheet1.Range("C5:D304").Select
With Selection
Selection.NumberFormat = "General"
.Value = .Value
End With
Sheet1.Range("A4:D304").Select
ActiveWorkbook.Worksheets("Output").Sort.SortFields.clear
ActiveWorkbook.Worksheets("Output").Sort.SortFields.Add Key:=Range("C5:C304") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("output").Sort
.SetRange Range("A4:D304")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.DisplayAlerts = True
End Sub