返回列表 上一主題 發帖

[發問] 請問各位大大,如何簡化以下程式

[發問] 請問各位大大,如何簡化以下程式

各位大大好

以下是我錄製的程式碼
我想在'A12:L44'畫框線
不過程式好像有點長
請問要如何簡化呢?
  1. Sub 畫格線2()
  2. '
  3. ' 畫格線2 Macro
  4. ' alex 在 2012/7/13 錄製的巨集
  5. '

  6.     Range("A12:L44").Select
  7.     ActiveWindow.SmallScroll Down:=-12
  8.     Selection.Borders(xlDiagonalDown).LineStyle = xlNone
  9.     Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  10.     With Selection.Borders(xlEdgeLeft)
  11.         .LineStyle = xlContinuous
  12.         .Weight = xlThin
  13.         .ColorIndex = xlAutomatic
  14.     End With
  15.     With Selection.Borders(xlEdgeTop)
  16.         .LineStyle = xlContinuous
  17.         .Weight = xlThin
  18.         .ColorIndex = xlAutomatic
  19.     End With
  20.     With Selection.Borders(xlEdgeBottom)
  21.         .LineStyle = xlContinuous
  22.         .Weight = xlThin
  23.         .ColorIndex = xlAutomatic
  24.     End With
  25.     With Selection.Borders(xlEdgeRight)
  26.         .LineStyle = xlContinuous
  27.         .Weight = xlThin
  28.         .ColorIndex = xlAutomatic
  29.     End With
  30.     With Selection.Borders(xlInsideVertical)
  31.         .LineStyle = xlContinuous
  32.         .Weight = xlThin
  33.         .ColorIndex = xlAutomatic
  34.     End With
  35.     With Selection.Borders(xlInsideHorizontal)
  36.         .LineStyle = xlContinuous
  37.         .Weight = xlThin
  38.         .ColorIndex = xlAutomatic
  39.     End With
  40. End Sub
複製代碼

回復 2# oobird


    感謝超級版主~~~原來這麼簡單 ^-^

TOP

        靜思自在 : 做好事不能少我一人,做壞事不能多我一人。
返回列表 上一主題