文字に下線を設定する(Underline プロパティ)
2015/08/26
下線を設定(Underline プロパティ)
Underline プロパティは、文字に下線を設定します。設定には、XlUnderlineStyle 列挙型の定数を使用します。値の取得および設定が可能です。
【書式】
<取得>
object.Underline
<設定>
object.Underline = const
引数・戻り値
- object ・・・ 対象となる Font オブジェクトを指定します。
- const ・・・ 下線の種類を表すXlUnderlineStyle 列挙型の定数を指定します。
定数 値 内容 xlUnderlineStyleNone -4142 下線なし xlUnderlineStyleSingle 2 一重下線 xlUnderlineStyleDouble -4119 二重下線 xlUnderlineStyleSingleAccounting 4 一重下線(会計) xlUnderlineStyleDoubleAccounting 5 二重下線(会計)
下線を設定(Underline プロパティ)使用例
サンプルVBAソース
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Sub Sample_Font06() Range("B3:F3").Value = "aaa" '一重下線 Range("B3").Font.Underline = xlUnderlineStyleSingle '二重下線 Range("C3").Font.Underline = xlUnderlineStyleDouble '一重下線(会計) Range("D3").Font.Underline = xlUnderlineStyleSingleAccounting '二重下線(会計) Range("E3").Font.Underline = xlUnderlineStyleDoubleAccounting '下線なし Range("F3").Font.Underline = xlUnderlineStyleNone End Sub |
実行結果
関連記事
-
-
VBA の演算子(比較演算子)
比較演算子 比較演算子による演算の結果は「真」の場合は「True」、「偽」の場合 …
-
-
画面の更新を停止(ScreenUpdating プロパティ)
画面の更新を停止 マクロを実行すると、画面が更新されます。これにより、実行速度が …
-
-
ある数値が、複数の範囲のどの範囲に含まれるかを示す文字列を返す(Partition 関数)
Partition 関数 の使い方 Partition 関数は、ある数値が、区切 …
-
-
ユーザー定義定数(Const ステートメント)
定数を使う ユーザー定義の定数を使用するには、Const ステートメントを使って …
-
-
エラー(CVErr 関数・IsError 関数・Error 関数)
CVErr 関数(エラー番号をエラー値に変換する)の使い方 【書式】 retur …
-
-
文字列:文字列左から指定文字数取得(Left 関数,LeftB 関数)
Left 関数・LeftB 関数 の使い方 【書式】 result_left = …
-
-
変数がオブジェクト型かどうかをチェックする( IsObject 関数 )
IsObject 関数の使い方 【書式】 result = IsObject ( …
-
-
文字列:2つの文字列を比較する(StrComp 関数)
StrComp 関数の使い方 【書式】 result = StrComp ( s …
-
-
文字列:文字列を最後から検索してその最初の文字位置を返す(InStrRev 関数)
InStrRev 関数 任意の文字列の中で、指定した文字列を最後から検索して、見 …
-
-
文字列:文字を指定数並べた文字列を返す(String 関数)
String 関数 【書式】 result = String ( number, …
