Macro sort issue

Dan Wilson

Well-known Member
Joined
Feb 5, 2006
Messages
507
Office Version
  1. 365
Platform
  1. Windows
Good day. I am running Excel out of Office 365 on Windows 10. I have a worksheet that contains user entered data in Column F and a formula in Column G. There are two identical macros that sort the data in these two columns. The only difference between the macros is that one references Column F and the other Column G. Columns F and G are both formatted as Data with no decimal points. Column F is user entered data, Column G is calculated. When I run the Column F sort, all is well and the data is sorted in descending order. When I run the Column G sort, the data is sorted showing all "0" calculations first, then the remainder in descending order. Even when I do a manual sort using the Developer Sort function, the results are the same. What am I doing wrong? Any help is appreciated.
Thanks, Danno...
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
No doubt your formula contains "0" which is textual so is greater than a number. Remove those inverted commas if you want "0" to truely be 0.
 
Upvote 0
Good day mole9999 and steve the fish. Steve, your reply was the one that fixed the problem. Mole, I'm sure that had I answered your reply, you would have had the same answer. That is so simple. I did not know that "0" was different from 0. Now I have a ton of editing to do to fix that problem in other macros and formulas on the worksheets. This forum is the BEST!
Thanks, Danno...
 
Upvote 0
on a copy, just test find replace and see if you can do it quicker
 
Upvote 0
Thank you Mole9999. I am very familiar with editing shortcuts. I just have a lot of worksheets to check and edit.
Thanks, Danno...
 
Upvote 0
Assuming the "0" are mostly in the formulas as ,"0" you could try this:

Code:
For Each sh In ThisWorkbook.Worksheets
    sh.Cells.Replace What:=",""0""", Replacement:=",0", LookAt:=xlPart
Next
 
Upvote 0
Thank you Steve, I'll put that code in my Excel Notes for future use. Looks like an easy way to edit several macros at the same time.
Thanks, Danno...
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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