| 
    
     |  | こんにちは。とりあえず、 
 Sub sample()
 MsgBox test_SEN(ActiveCell, Range("e1").Value _
 , Range("e2").Value, Range("e3").Value, Range("e4").Value)
 End Sub
 
 Function test_SEN(自身のCELL As Range, E1 As Double, _
 E2 As Double, E3 As Double, E4 As Double)
 '罫線情報取得テスト
 Dim KEISEN_TOP As Long
 Dim KEISEN_LEFT As Long
 Dim KEISEN_BOTTOM As Long
 Dim KEISEN_RIGHT As Long
 Dim shoukei As Double
 shoukei = 0
 KEISEN_TOP = 自身のCELL.Borders(xlEdgeTop).LineStyle
 KEISEN_LEFT = 自身のCELL.Borders(xlEdgeLeft).LineStyle
 KEISEN_RIGHT = 自身のCELL.Borders(xlEdgeRight).LineStyle
 KEISEN_BOTTOM = 自身のCELL.Borders(xlEdgeBottom).LineStyle
 If KEISEN_TOP <> xlNone Then shoukei = shoukei + E1
 If KEISEN_LEFT <> xlNone Then shoukei = shoukei + E2
 If KEISEN_RIGHT <> xlNone Then shoukei = shoukei + E4
 If KEISEN_BOTTOM <> xlNone Then shoukei = shoukei + E3
 test_SEN = shoukei
 End Function
 
 などとすれば動くでしょうけど、もう少しすっきりするような気はします。
 
 With 自身のCELL
 If .Borders(xlEdgeTop).LineStyle <> xlNone Then shoukei = shoukei + E1
 If .Borders(xlEdgeLeft).LineStyle <> xlNone Then shoukei = shoukei + E2
 If .Borders(xlEdgeRight).LineStyle <> xlNone Then shoukei = shoukei + E4
 If .Borders(xlEdgeBottom).LineStyle <> xlNone Then shoukei = shoukei + E3
 End With
 
 あと、E1:E4までの引数設定についても、配列を使ったほうがいいのでしょうけど?
 (今ひとつ詳しくないのでパスします)
 
 
 |  |