Unable to identify the greater number

Alfredhigh

New Member
Joined
Aug 11, 2022
Messages
10
Office Version
  1. 2010
Platform
  1. Windows
Dear Sir/Mdm,



I used the "Conditional Formatting" to format the cell to greater than, but why the three cell(circle in red) didn't change color?
 

Attachments

  • Excel issue.PNG
    Excel issue.PNG
    15.9 KB · Views: 13

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The custom number format [<999999]0.00;[<99999900]0.00,," M";0.00,,," B" will display numbers in the format shown. (This uses a US billion)
 
Upvote 0
That is a custom number format, not VBA code. If you format your cells with that format. It will take the numbers entered (as numbers) and display them in the format shown. Then the normal operations, like sorting, will act as expected.
The OP shows a sheet with text entries, which is the root of the problem. Changing the sheet values to numbers will correct those problems.
 
Upvote 0
That is a custom number format, not VBA code. If you format your cells with that format. It will take the numbers entered (as numbers) and display them in the format shown. Then the normal operations, like sorting, will act as expected.
The OP shows a sheet with text entries, which is the root of the problem. Changing the sheet values to numbers will correct those problems.
Click where to do that?
 
Upvote 0
I already provided you with the code last week up in post #6 in order to change the values to valid numbers.
You can simply add a line to change the cell format at the same time, i.e.
VBA Code:
Sub ConvertNums()

    Dim cell As Range
    
    Application.ScreenUpdating = False
    
'   Change format of selected cells
    Selection.NumberFormat = "0"

'   Run against every cell in selected range
    For Each cell In Selection
        Select Case Right(cell, 1)
            Case "M"
                cell.Value = Left(cell, Len(cell) - 1) * 1000000
            Case "B"
                cell.Value = Left(cell, Len(cell) - 1) * 1000000000
        End Select
    Next cell
    
    Application.ScreenUpdating = True
        
End Sub
 
Upvote 0
I already provided you with the code last week up in post #6 in order to change the values to valid numbers.
You can simply add a line to change the cell format at the same time, i.e.
VBA Code:
Sub ConvertNums()

    Dim cell As Range
   
    Application.ScreenUpdating = False
   
'   Change format of selected cells
    Selection.NumberFormat = "0"

'   Run against every cell in selected range
    For Each cell In Selection
        Select Case Right(cell, 1)
            Case "M"
                cell.Value = Left(cell, Len(cell) - 1) * 1000000
            Case "B"
                cell.Value = Left(cell, Len(cell) - 1) * 1000000000
        End Select
    Next cell
   
    Application.ScreenUpdating = True
       
End Sub
Hi Joe4, May I know add what line to change the cell format?
 
Upvote 0
Hi Joe4, May I know add what line to change the cell format?
If you look closely, and compare the code I posted in my last post to the code I posted previously, you will see that I already added it for you:
VBA Code:
    Selection.NumberFormat = "0"
So all you need to do is copy & paste the code from my last post. Everything you need should be there.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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