Basic VBA help for a simple sort

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
793
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a line of code that I am just trying to sort column A by (sort A to Z) to remove a random blank row in my data set. So blank row just moved to the end, for example (unmodified):
12345
2345
2222
3333

but i keep getting this error? what am i doing wrong, it seems so simplistic
1671236287171.png


VBA Code:
'run for items in O format to use for CU condition = XXXXX
With WsO
    .Range("A:A").NumberFormat = "@"
    .Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
    .Sort.SortFields.Clear
    .Range("A:A").Sort Key1:=Range("A1"), Header:=xlNo
    s = Join(Application.Transpose(.Range("A1", .Range("A" & rows.count).End(xlUp)).Value), ":")
    .Range("FILTER").Value = s
    .Range("B2").Value = .[Len(filter)]
End With
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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