small font in bracket

Jagat Pavasia

Active Member
Joined
Mar 9, 2015
Messages
406
Office Version
  1. 2021
Platform
  1. Windows
hello, dear sir/ madam,

my E6 to I500 have amount and then some text in bracket.
I want font size 8 in bracket.

example picture is below :
please help me with VBA code:

22.JPG





help me
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Perhaps you could try something like the below:
VBA Code:
Sub ChangeSize()
    Dim rng As Range, rCell As Range, v As String, f As Integer, l As Integer
    
    Set rng = Range("E6:I500").SpecialCells(xlCellTypeConstants)
    
    For Each rCell In rng
        With rCell
            v = .Value
            f = InStr(v, "(")
            l = Len(v) + 1
            .Characters(f, l - f).Font.Size = 8
        End With
    Next rCell
End Sub
 
Upvote 0
You might also consider changing this line:
VBA Code:
.Characters(f, l - f).Font.Size = 8

To this:
VBA Code:
.Characters(f, l - f).Font.Superscript = True
Or:
VBA Code:
.Characters(f, l - f).Font.Subscript = True
 
Upvote 0
Perhaps you could try something like the below:
VBA Code:
Sub ChangeSize()
    Dim rng As Range, rCell As Range, v As String, f As Integer, l As Integer
   
    Set rng = Range("E6:I500").SpecialCells(xlCellTypeConstants)
   
    For Each rCell In rng
        With rCell
            v = .Value
            f = InStr(v, "(")
            l = Len(v) + 1
            .Characters(f, l - f).Font.Size = 8
        End With
    Next rCell
End Sub
did not work
 
Upvote 0
Going to need more detail about what you have in your cells and a better explanation than "did not work"

Did it do nothing?
Did it change the wrong part of the text?
Did it change all of the text?
Do you have numbers with no text?
etc.

Perhaps you could upload some of your data using XL2BB add-in:
 
Upvote 0
Perhaps you could try something like the below:
VBA Code:
Sub ChangeSize()
    Dim rng As Range, rCell As Range, v As String, f As Integer, l As Integer
   
    Set rng = Range("E6:I500").SpecialCells(xlCellTypeConstants)
   
    For Each rCell In rng
        With rCell
            v = .Value
            f = InStr(v, "(")
            l = Len(v) + 1
            .Characters(f, l - f).Font.Size = 8
        End With
    Next rCell
End Sub
my Dear.........it did not work anything in my excel sheet, even i used new sheet and then try it
 
Upvote 0
Can you attach a sample of your data using XL2BB or upload your file on some platform and share the link here
 
Upvote 0
Are the values in those columns from a formula?
 
Upvote 0
Going to need more detail about what you have in your cells and a better explanation than "did not work"

Did it do nothing?
Did it change the wrong part of the text?
Did it change all of the text?
Do you have numbers with no text?
etc.

Perhaps you could upload some of your data using XL2BB add-in:

222.JPG




I create new micro enable sheet, and then try it.
but it did not work anything,,,
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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