返回列表 上一主題 發帖

[發問] 不等於空白的儲存格畫框線

回復 2# papaya


    參考看看
  1.   Sub 畫框線2()

  2.     Columns("A:B").FormatConditions.Delete
  3.     With Columns("A:B").FormatConditions.Add(Type:=xlCellValue, Operator:=xlNotEqual, _
  4.         Formula1:="=""""")
  5.         With .Borders(xlLeft)
  6.             .LineStyle = xlContinuous
  7.             .Weight = xlThin
  8.             .ColorIndex = xlAutomatic
  9.         End With
  10.         With .Borders(xlRight)
  11.             .LineStyle = xlContinuous
  12.             .Weight = xlThin
  13.             .ColorIndex = xlAutomatic
  14.         End With
  15.         With .Borders(xlTop)
  16.             .LineStyle = xlContinuous
  17.             .Weight = xlThin
  18.             .ColorIndex = xlAutomatic
  19.         End With
  20.         With .Borders(xlBottom)
  21.             .LineStyle = xlContinuous
  22.             .Weight = xlThin
  23.             .ColorIndex = xlAutomatic
  24.         End With
  25.     End With
  26. End Sub
複製代碼

TOP

回復 5# papaya

參考看看
  1. Sub 畫框線3()

  2.     Columns("A:B").FormatConditions.Delete
  3.     With Columns("A:B").FormatConditions.Add(Type:=xlCellValue, Operator:=xlNotEqual, _
  4.         Formula1:="=""""")
  5.         .Borders.LineStyle = xlContinuous
  6.     End With
  7. End Sub
複製代碼
搜尋功能可以多利用Google搜尋
搜尋特定網站
關鍵字+site:網站網址

TOP

回復 5# papaya


    加註解
  1. Sub 畫框線3()

  2.     Columns("A:B").FormatConditions.Delete '刪除A.B欄格式化條件
  3.     With Columns("A:B").FormatConditions.Add(Type:=xlCellValue, Operator:=xlNotEqual, _
  4.         Formula1:="=""""") '在A.B欄新增一個格式化條件,條件為儲存格不為空白
  5.         .Borders.LineStyle = xlContinuous '設定格式化條件的外框格式
  6.     End With
  7. End Sub
複製代碼

TOP

        靜思自在 : 有時當思無時苦,好天要積雨來糧。
返回列表 上一主題