To get list of Boolean Values of .Range.Font.Bold/.Underline/.Strikethrough./Italics etc

SamDsouza

Board Regular
Joined
Apr 16, 2016
Messages
205
Hello
Just require your guidance
Am Bit confussed

Where can i get list of numeric boolean values of TRUE and FALSE which represent their numeric values like 0, 1 or -1
Whereever explored it mentions TRUE or FALSE and nothing in numeric

TxtBold.Text = .Range("A1").Font.Bold

this returns 0 in above textbox so i dont know whether this TRUE or FALSE

if i come to know the numeric values then i would like textbox.text display its value as TRUE or FALSE rather than numeric boolean values

Same thing applies for Font.underline/Strikethrough, italic etc


i went here to
MS-DOCS LINK
but nothing specific

SamD
182
Thread :1162443 Post #1
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
0 is False & anything else is true.
That said with your code the textbox returns true or false for me. Also Underline is not a boolean values as there are different types of underlining.
 
Upvote 0
Fluff
0 is False & anything else is true.
Thanks for the clarification.

Also Underline is not a boolean values as there are different types of underlining.
On your above remark. How can i then determine whether the sting / Text /Word(s) is underlined (True or False) and which type of Underlining has been used.

SamD
184
 
Upvote 0
How can i then determine whether the sting / Text /Word(s) is underlined (True or False) and which type of Underlining has been used.
Something like this?

VBA Code:
Sub UnderlineDetails()
  Dim x As Long
  Dim sUnder As String
  
  x = ActiveCell.Font.Underline
  Select Case x
    Case 2: sUnder = "Single"
    Case 4: sUnder = "Single accounting"
    Case 5: sUnder = "Double accounting"
    Case -4119: sUnder = "Double"
    Case -4142: sUnder = "None"
  End Select
  MsgBox "Underline Style is " & sUnder
End Sub

Ref:
 
Upvote 0
Thank you Sir for your prompt reply

I was thinking is there any way to shortern the following statements of SELECT CASE.... as shown below
because Under Each case i've to add the following syntaxes : txtUndLineType.Text = sUnder : txtFontUnderlined.Text = "TRUE"
Rich (BB code):
Sub UnderlineDetails()
  Dim x As Long
  Dim sUnder As String

  x = ActiveCell.Font.Underline
  Select Case x
    Case 2: sUnder = "Single" : txtUndLineType.Text = sUnder :       txtFontUnderlined.Text = "TRUE"
    Case 4: sUnder = "Single accounting" : txtUndLineType.Text = sUnder :  txtFontUnderlined.Text = "TRUE"
    Case 5: sUnder = "Double accounting" : txtUndLineType.Text = sUnder :  txtFontUnderlined.Text = "TRUE"
    Case -4119: sUnder = "Double": txtUndLineType.Text = sUnder : txtFontUnderlined.Text = "TRUE"
    Case -4142: sUnder = "None": txtUndLineType.Text= sUnder :   txtFontUnderlined.Text = "TRUE"
  End Select
  MsgBox "Underline Style is " & sUnder

If x = 0 Then
    txtFontUnderlined.Text = "FALSE"
ELse
    txtFontUnderlined.Text = "TRUE"
End If

End Sub
SamD
185
 
Last edited:
Upvote 0
Untested, but see if this does what you want.

VBA Code:
Sub UnderlineDetails()
  Dim x As Long
  Dim sUnder As String

  x = ActiveCell.Font.Underline
  Select Case x
    Case 2: sUnder = "Single"
    Case 4: sUnder = "Single accounting"
    Case 5: sUnder = "Double accounting"
    Case -4119: sUnder = "Double"
    Case -4142: sUnder = "None"
  End Select
  
  txtUndLineType.Text = sUnder
  txtFontUnderlined.Text = x <> -4142
 
End Sub
 
Upvote 0
Solution
Excellent Sir, :LOL::LOL::LOL: Really Saved Time and Efforts ?
Except wanted the Below Syntax in Capitals or UCASE$
Rich (BB code):
txtFontUnderlined.Text = x <> -4142

txtFontUnderlined.Text = UCASE(x <> -4142)
did not work

Now i would not like to bother you but wanted to know as it is related to Fonts
The List of Font.Names on Excel Worksheet in Home Button and Userform.Textbox.Font.Names are Equal or is the List of Font Names limited in userform.Textbox
Same question applies for MS-word.

SamD
186
MT: 1162443 :#7
 
Last edited:
Upvote 0
What is txtFontUnderlined?
Where is i?
How is it declared/defined?

"did not work" is not very descriptive. What did happen? eg error, wrong text, something else?

In relation to your other questions, they are in an area that is not a strength of mine. I suggest that you start a new thread about that.
 
Upvote 0
What is txtFontUnderlined?
Where is i?
How is it declared/defined?

"did not work" is not very descriptive. What did happen? eg error, wrong text, something else?

In relation to your other questions, they are in an area that is not a strength of mine. I suggest that you start a new thread about that.

Hope this helps, good luck.
Thank you sir, for spending valuable Time and indeed great inputs I've resolved the same
from the Uppercase VBA UserForm Textbox

In relation to your other questions, they are in an area that is not a strength of mine. I suggest that you start a new thread about that.
Ok. :)

Thank you Sir once more


SamD
187
MT: 1162443 :#8
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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