關於跨欄置中和框線畫線是否有比較簡易的寫法(謝謝各位大大,已解決。)
- 帖子
- 712
- 主題
- 281
- 精華
- 0
- 積分
- 1019
- 點名
- 0
- 作業系統
- Windows 10
- 軟體版本
- Office 2019
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2011-6-30
- 最後登錄
- 2025-5-22
|
關於跨欄置中和框線畫線是否有比較簡易的寫法(謝謝各位大大,已解決。)
本帖最後由 av8d 於 2012-4-27 08:12 編輯
首先A1:H1和A2:H2欄取消跨欄置中- Range("A1:G1").Select
- With Selection
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- Selection.Merge
- Range("A2:G2").Select
- With Selection
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- Selection.Merge
- End Sub
複製代碼 然後是A1:G1和A2:G2跨欄置中- Range("A1:H1").Select
- With Selection
- .HorizontalAlignment = xlGeneral
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = True
- End With
- Selection.UnMerge
- Range("A2:H2").Select
- With Selection
- .HorizontalAlignment = xlGeneral
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = True
- End With
- Selection.UnMerge
複製代碼 然後A1:G2框線畫右線- Range("A1:G2").Select
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Selection.Borders(xlInsideVertical).LineStyle = xlNone
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- End Sub
複製代碼 |
|
|
|
|
|
|
|