文字に下線を設定する(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 |
実行結果
関連記事
-
-
データ型を調べて、そのデータ型を示す数値を返す(VarType 関数)
VarType 関数 の使い方 VarType 関数は、引数に、データ型を調べた …
-
-
書式を変換(Format 関数)
Format 関数の使い方 【書式】 result = Format ( exp …
-
-
配列の添字の最小値を「1」に設定する
Option Base ステートメントを使用する 【書式】 Option Bas …
-
-
四捨五入・切り上げ・切り捨て・丸め(Round 関数 他)
Round 関数(丸め)の使い方 【書式】 value = Round ( ex …
-
-
VBA の演算子(演算子の優先順位)
演算子の優先順位 演算子の優先順位とは、1つの式の中に演算子が複数ある場合、どの …
-
-
コレクション(Collection)オブジェクト「連想配列」
コレクション(Collection)オブジェクトの使い方 【書式】 Dim my …
-
-
日付時刻:日付・時刻の間隔を取得( DateDiff 関数 )
DateDiff 関数の使い方 【書式】 result = DateDiff ( …
-
-
色の設定(ColorIndex プロパティ・Colors プロパティ)
ColorIndex プロパティ ColorIndex プロパティは、指定したオ …
-
-
文字列:文字列の一部を別の文字列で置換(Replace 関数)
Replace 関数の使い方 【書式】 result = Replace ( s …
-
-
文字列:文字列の空白を削除(Trim 関数, LTrim関数, RTrim関数)
Trim 関数・LTrim 関数・RTrim 関数の使い方 【書式】 <先頭と末 …
