文字に下線を設定する(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 |
実行結果
関連記事
-
-
日付時刻:数値から日付・時刻データを取得( DateSerial 関数、TimeSerial 関数 )
DateSerial 関数(数値を使って日付データを取得) 【書式】 date …
-
-
IME の現在の状態を取得します(IMEStatus 関数)
IMEStatus 関数の使い方 【書式】 result = IMEStatus …
-
-
コレクション(Collection)オブジェクト「連想配列」
コレクション(Collection)オブジェクトの使い方 【書式】 Dim my …
-
-
変数がEmpty 値かどうかをチェックする( IsEmpty 関数 )
IsEmpty 関数の使い方 【書式】 result = IsEmpty ( e …
-
-
VBA の演算子(比較演算子)
比較演算子 比較演算子による演算の結果は「真」の場合は「True」、「偽」の場合 …
-
-
フォント 太字・斜体(Bold, Italic, FontStyle プロパティ)
太字の設定(Bold プロパティ) Bold プロパティは、フォントを太字にする …
-
-
Math 関数( Abs,Atn,Cos,Exp,Log,Rnd,Sgn,Sin,Sqr,Tan )
Abs 関数 【書式】 value = Abs ( number ) 【引数・戻 …
-
-
列挙型変数(Enum ステートメント)
列挙型変数を使う 列挙型変数を使用するには、Enum ステートメントを使って、宣 …
-
-
インプットボックスを表示する(InputBox関数・InputBoxメソッド)
「InputBox関数」と「InputBoxメソッド」の違い 「InputBox …
-
-
VBA で正規表現を使う(RegExp オブジェクトのプロパティ)
RegExp オブジェクトのプロパティ RegExp オブジェクトの詳細に関して …
