返回列表 上一主題 發帖

畫格線要細框變成粗框

畫格線要細框變成粗框

請問大大:

我這樣的程式畫的線格式細框
如何改可以變成粗框
謝謝

Sub 畫格線()
lra = Range("A3").End(xlDown).Row  '自動偵測
For M = 3 To lra      '從A3格開始

Range("A" & M & ":R" & M).Select     '範圍
   ActiveCell.CurrentRegion.Select      '選取儲存格範圍
                        
With Selection.Borders     '畫格線
     .LineStyle = xlContinuous
     .Weight = xlThin
     .ColorIndex = xlAutomatic
End With
Next M
End Sub
michael

Sub 畫格線()
lra = Range("A3").End(xlDown).Row  '自動偵測
For M = 3 To lra      '從A3格開始

Range("A" & M & ":R" & M).Select     '範圍
   ActiveCell.CurrentRegion.Select      '選取儲存格範圍
                        
With Selection.Borders     '畫格線
     .LineStyle = xlContinuous
     .Weight = xlThick
     .ColorIndex = xlAutomatic
End With
Next M
End Sub

Weight就是設定線的粗細
clio

TOP

回復 1# chairles59
回復 2# clio
請參考:
  1. Sub 畫格線()
  2.     Dim lra As Integer                      '  畫格框線的終止列
  3.     Dim lstart As Integer                   '  畫格框線的起始列

  4.     lra = Range("A3").End(xlDown).Row       '  自動偵測
  5.     lstart = 3

  6.     '  Range("A" & lstart & ":R" & lra).Select
  7.                               
  8.     '  With Selection.Borders               '  畫格框線的範圍     
  9.     With Range("A" & lstart & ":R" & lra).Borders
  10.         .LineStyle = xlContinuous
  11.         '  .Weight = xlThin                 '  細框  設定線的粗細
  12.         .Weight = xlThick                   '  粗框  設定線的粗細
  13.         .ColorIndex = xlAutomatic
  14.     End With
  15. End Sub
複製代碼

TOP

回復 4# c_c_lai

謝謝大大詳細的介紹
michael

TOP

        靜思自在 : 【生命在呼吸間】佛陀說:「生命在呼吸間。」人無法管住自己的生命,更無法擋住死期,讓自己永住人間。既然生命去來這麼無常,我們更應該好好地愛惜它、利用它、充實它,讓這無常、寶貴的生命,散發它真善美的光輝,映照出生命真正的價值。
返回列表 上一主題