Macro help (Replace M)

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
I copy and paste market cap data from NASDAQ and paste the results in col H The results I get when sorted is:

96,323 M
9,128 M
833 M
670 M
613 M
530 M
47,681 M

How do I replace the M with ,000 so when sorted it will be correct? Begins in cell H19
The macro I'm using is:


Sub SortH()
'
' SortH Macro
'
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear

ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range( _
"H19:H9999"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal


With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A19:AZZ9999")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply

End With
Range("F5").Select
ActiveWorkbook.Worksheets("Sheet1").Range("H19").Select

End Sub

or is there another way to handle this?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You can do this without VBA.
Select the cells you want > Ctrl H > in the find what put " M" (without the quotes, but note the leading space) > in the replace with box put ,000 > replace all
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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