返回列表 上一主題 發帖

請問vba的內外框線

回復 1# eric093
這是不是符合你所要的答案?
  1. Sub Ex()
  2.     With Range("A1:C4")
  3.         .Borders(xlEdgeLeft).Weight = xlMedium
  4.         .Borders(xlEdgeTop).Weight = xlMedium
  5.         .Borders(xlEdgeBottom).Weight = xlMedium
  6.         .Borders(xlEdgeRight).Weight = xlMedium
  7.         .Borders(xlInsideVertical).Weight = xlHairline
  8.         .Borders(xlInsideHorizontal).Weight = xlHairline
  9.     End With
  10. End Sub
複製代碼

TOP

本帖最後由 c_c_lai 於 2013-7-19 07:06 編輯

回復 3# GBKEE
您的模組比較適宜,且又簡潔,謝謝!
  1. Sub Ex2()
  2.     With Range("A1:C4").Borders            '  Borders(框線)物件
  3.         .LineStyle = 3                         '   框線的式樣
  4.         .ColorIndex = 15                  '   框線的顏色 1:黑 2:無 3:紅 4:淡綠 5:藍 6:黃 7:橘 8:天藍 9:紫 15:灰
  5.         .Weight = 1                            '   框線的粗細 xlHairline = 1 (毫線(最細的框線))、xlThin = 2 (細線)、
  6.         '                          xlMedium = -4138 (適中)、xlThick = 4 (粗線 (最寬的框線) )
  7.         .Parent.BorderAround 1, xlMedium, 1             '   BorderAround(外框) LineStyle, Weight, ColorIndex
  8.     End With
  9. End Sub
複製代碼

TOP

        靜思自在 : 難行能行,難捨能捨,難為能為,才能昇華自我的人格。
返回列表 上一主題