當前位置:成語大全網 - 新華字典 - VBA中測得第壹個小計的行數是h,想把h下壹行的下表格線改為粗線或雙實線該怎麽做?

VBA中測得第壹個小計的行數是h,想把h下壹行的下表格線改為粗線或雙實線該怎麽做?

因為要設置的並不是整行,而是單元格Ah:Hh這個區域的下表格線

所以代碼如下:

r=("A" & h &" : H" & h)

range(r).Borders(xlEdgeBottom).LineStyle = xlContinuous

xlContinuous是EXCEL邊框線的壹種

還有其它的,可以自己錄制宏去看看

上面是修改過的代碼

下面的是錄制的代碼

Sub Macro2()

'

' Macro2 Macro

' 宏由 YlmF 錄制,時間: 2009-11-24

'

'

Range("A3:H3").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone

Selection.Borders(xlDiagonalUp).LineStyle = xlNone

Selection.Borders(xlEdgeLeft).LineStyle = xlNone

Selection.Borders(xlEdgeTop).LineStyle = xlNone

With Selection.Borders(xlEdgeBottom)

.LineStyle = xlContinuous

.Weight = xlMedium

.ColorIndex = xlAutomatic

End With

Selection.Borders(xlEdgeRight).LineStyle = xlNone

Selection.Borders(xlInsideVertical).LineStyle = xlNone

End Sub