« 別のシートのセルと同期する | トップページ | Patternの見本 »

2010年3月27日 (土)

LineStyleの見本

セルの枠線、LineStyleとWeightの表をつくります。

コードはこちら

LineStyleの見本を作るコード:

Sub macro100327a()
'LineStyle見本

    SheetAddCDel ("LineStyle見本")
    Dim i As Integer, j As Integer
    Dim ValueLineStyle, StrLineStyle As Variant
    Dim ValueLineWeight, StrLineWeight As Variant
    ValueLineStyle = Array(xlContinuous, xlDash, xlDashDot, _
        xlDashDotDot, xlDot, xlDouble, xlSlantDashDot, xlLineStyleNone)
    StrLineStyle = Array("xlContinuous", "xlDash", "xlDashDot", _
        "xlDashDotDot", "xlDot", "xlDouble", "xlSlantDashDot", "xlLineStyleNone")
    ValueLineWeight = Array(xlHairline, xlThin, xlMedium, xlThick)
    StrLineWeight = Array("xlHairline", "xlThin", "xlMedium", "xlThick")
   
    Cells(1, 1) = "LineStyle/Weight"
    For i = 0 To 3
        Cells(1, 3 + i * 2) = StrLineWeight(i)
        Range(toA1("C" & 2 + i * 2)).ColumnWidth = 2
    Next i
    For i = 0 To 7
        Range("A" & 3 + 2 * i) = StrLineStyle(i)
        With Range("C" & 3 + 2 * i).Borders
            .LineStyle = ValueLineStyle(i)
            .Weight = ValueLineWeight(0)
        End With
        With Range("E" & 3 + 2 * i).Borders
            .LineStyle = ValueLineStyle(i)
            .Weight = ValueLineWeight(1)
        End With
        With Range("G" & 3 + 2 * i).Borders
            .LineStyle = ValueLineStyle(i)
            .Weight = ValueLineWeight(2)
        End With
        With Range("I" & 3 + 2 * i).Borders
            .LineStyle = ValueLineStyle(i)
            .Weight = ValueLineWeight(3)
        End With
    Next i
    Columns(1).AutoFit
End Sub

実行後のシート
Vba20100327a

|

« 別のシートのセルと同期する | トップページ | Patternの見本 »

コメント

この記事へのコメントは終了しました。

トラックバック


この記事へのトラックバック一覧です: LineStyleの見本:

« 別のシートのセルと同期する | トップページ | Patternの見本 »