Sort it out!!!!!!

nigelandrewfoster

Well-known Member
Joined
May 27, 2009
Messages
747
This macro stops with "Application or object defined error at the red line. As far as I can see, the structure is identical to that which I have used successfully on other macros. What's the problem, please? Sheet is unprotected. Thanks.:eeek:
Code:
Dim put_row As Integer, get_row As Integer, inv_method As Variant, ws As Worksheet
Set ws = Worksheets("WEEKLY INVOICES")
ws.Range("clear_inv_list_col").Interior.ColorIndex = xlNone

ws.Range("GH13:GO117").Copy
ws.Range("GH126").PasteSpecial Paste:=xlPasteValues
With ws.Range("gh126:go230")
    [COLOR="Red"].Sort Key1:=.Range("GO126"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1[/COLOR]
End With
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Your sort key is wrong:
Rich (BB code):
With ws.Range("gh126:go230")
    .Sort Key1:=ws.Range("GO126"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1
End With
 
Upvote 0
Try this

Code:
With ws
    .Range("gh126:go230").Sort Key1:=.Range("GO126"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1
End With
 
Upvote 0
Thank you both for your prompt and helpful response. I'm up and running now. VBA can be so subtle sometimes. Or should that be often!!
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

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