返回列表 上一主題 發帖

一個清除斜框線問題

回復 1# 周大偉
關閉事件程序觸發
  1. Sub 清除斜線()
  2. '
  3. ' 清除斜線 Macro
  4. ' shchao 在 2010/11/15 錄製的巨集
  5. '

  6. '
  7. Application.EnableEvents = False
  8.     Range("B15:K34").Select
  9.     Selection.ClearContents
  10.     Selection.Borders(xlDiagonalDown).LineStyle = xlNone
  11.     Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  12.     With Selection.Borders(xlEdgeLeft)
  13.         .LineStyle = xlDouble
  14.         .Weight = xlThick
  15.         .ColorIndex = xlAutomatic
  16.     End With
  17.     With Selection.Borders(xlEdgeTop)
  18.         .LineStyle = xlDouble
  19.         .Weight = xlThick
  20.         .ColorIndex = xlAutomatic
  21.     End With
  22.     With Selection.Borders(xlEdgeBottom)
  23.         .LineStyle = xlContinuous
  24.         .Weight = xlThin
  25.         .ColorIndex = 15
  26.     End With
  27.     With Selection.Borders(xlEdgeRight)
  28.         .LineStyle = xlDouble
  29.         .Weight = xlThick
  30.         .ColorIndex = xlAutomatic
  31.     End With
  32.     With Selection.Borders(xlInsideVertical)
  33.         .LineStyle = xlContinuous
  34.         .Weight = xlMedium
  35.         .ColorIndex = 15
  36.     End With
  37.     With Selection.Borders(xlInsideHorizontal)
  38.         .LineStyle = xlContinuous
  39.         .Weight = xlThin
  40.         .ColorIndex = 15
  41.     End With
  42.     Range("E8:F8").Select
  43.     Application.EnableEvents = True
  44. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 4# 周大偉


    希望在這2個回覆中您能了解幾個重點
1、程式碼中的SELECT會觸發事件程序的解決方法
2、錄製巨集後應去解讀程式碼的意義,才能去蕪存菁減短程式碼,易於日後修正
學海無涯_不恥下問

TOP

        靜思自在 : 口說一句好話,如口出蓮花;口說一句壞話如口吐毒蛇。
返回列表 上一主題