D
David
Hello All,
I am trying to write some late binding Excel automation code, but
having problems with line# 235 below. Error is Number 1004,
Application-defined or object-defined error.
Dim objXLApp As Object
Dim objXLBook As Object
Dim obj_Sheet1 As Object
Dim obj_Sheet11 As Object
Dim LastRow As Integer
Dim Rng As Object
Const xlAscending = 1
Const xlYes = 1
180 Set obj_Sheet1 = objXLBook. _
Worksheets("Sheet1")
190 Set obj_Sheet11 = objXLBook. _
Worksheets("Sheet11")
200 LastRow = obj_Sheet11.UsedRange.Rows.Count
210 If LastRow > 1 Then
220 obj_Sheet11.Range("A1:N" & LastRow).Copy
230 obj_Sheet1.Range("A1:N1").PasteSpecial -4163
235 With obj_Sheet1
.Range(.Range("A1"), .Cells(.Rows.Count, "N").End(xlUp)).Sort _
Key1:=.Range("A2"), Order1:=xlAscending, _
Key2:=.Range("B2"), Order2:=xlAscending, _
Key3:=.Range("D2"), Order3:=xlAscending, _
Header:=xlYes
End With
240 obj_Sheet1.Range("1:1").autofilter
Thanks in advance for your assistance.
Dave
I am trying to write some late binding Excel automation code, but
having problems with line# 235 below. Error is Number 1004,
Application-defined or object-defined error.
Dim objXLApp As Object
Dim objXLBook As Object
Dim obj_Sheet1 As Object
Dim obj_Sheet11 As Object
Dim LastRow As Integer
Dim Rng As Object
Const xlAscending = 1
Const xlYes = 1
180 Set obj_Sheet1 = objXLBook. _
Worksheets("Sheet1")
190 Set obj_Sheet11 = objXLBook. _
Worksheets("Sheet11")
200 LastRow = obj_Sheet11.UsedRange.Rows.Count
210 If LastRow > 1 Then
220 obj_Sheet11.Range("A1:N" & LastRow).Copy
230 obj_Sheet1.Range("A1:N1").PasteSpecial -4163
235 With obj_Sheet1
.Range(.Range("A1"), .Cells(.Rows.Count, "N").End(xlUp)).Sort _
Key1:=.Range("A2"), Order1:=xlAscending, _
Key2:=.Range("B2"), Order2:=xlAscending, _
Key3:=.Range("D2"), Order3:=xlAscending, _
Header:=xlYes
End With
240 obj_Sheet1.Range("1:1").autofilter
Thanks in advance for your assistance.
Dave