Macro help : need to bold and color arrow

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
884
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team,

I have data with Arrow and I need to keep up arrow green and the down arrow red and the number to be bold.
Please see the image for ref.

Book1
JKLMNOP
3-0.2000000
40.41-0.11-0.51-1.3
51.7591.5595.3 r61-3.6
68.6 p158.5 p255.5 r291.9
70.9312.343-248-4.5
80.643.0 r8-0.791
95.9 p266.8 p422.748-6.4 q
106.0 p246.3 r392.845-5.5
114.6 p152.536-2.838-5.7
121.15-1.58-3.8 q5-2.5 q
1311.0 p-197.1 p9-1.420-7.7 q
Sheet1


1659077517135.png
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
If you want the contents of a cell to contain more than one color, you will need to use VBA code. Would that be possible?

Alternatively, you would normally see the arrows in their own cell/column next to the numbers, in which case it would be easy to do what you're asking.
 
Upvote 0
If you want the contents of a cell to contain more than one color, you will need to use VBA code. Would that be possible?

Alternatively, you would normally see the arrows in their own cell/column next to the numbers, in which case it would be easy to do what you're asking.

Hi Dan,

Yes VBA works for me :)
 
Upvote 0
VBA Code:
Sub v()
Dim cel As Range, rng As Range
Set rng = Range("J3:P" & Cells(Rows.Count, "J").End(3).Row)
rng.Font.Bold = False
For Each cel In rng
    If Not IsNumeric(Right(cel, 1)) Then
        cel.Font.Bold = True
        With cel.Characters(Len(cel), 1)
            Select Case Left(cel, 1)
                Case Is = "-"
                     cel = Left(cel, Len(cel) - 1) & "q"
                    .Font.ColorIndex = 3
                Case Else
                     cel = Left(cel, Len(cel) - 1) & "p"
                    .Font.ColorIndex = 4
            End Select
            .Font.Name = "Wingdings 3"
        End With
    End If
Next
End Sub
 
Last edited:
Upvote 0
VBA Code:
Sub v()
Dim cel As Range, rng As Range
Set rng = Range("J3:P" & Cells(Rows.Count, "J").End(3).Row)
rng.Font.Bold = False
For Each cel In rng
    If Not IsNumeric(Right(cel, 1)) Then
        cel.Font.Bold = True
        With cel.Characters(Len(cel), 1)
            Select Case Left(cel, 1)
                Case Is = "-"
                     cel = Left(cel, Len(cel) - 1) & "q"
                    .Font.ColorIndex = 3
                Case Else
                     cel = Left(cel, Len(cel) - 1) & "p"
                    .Font.ColorIndex = 4
            End Select
            .Font.Name = "Wingdings 3"
        End With
    End If
Next
End Sub

Woooooooooooooooooooo...!!!!!! Simply Awesome...!!!!

You made my Friday Fantastic................!!!!!


Thank you once again for your hard work on this:):)
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,697
Members
449,117
Latest member
Aaagu

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