這個可以用表格事件來實現:開啟“開發工具”—“Visual Basic—“在右邊的視窗選擇Wroksheet物件和Change過程”—把程式碼複製進進去—然後儲存excel檔案為“
.xlsm
If Target <> "" Then
Target.Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
With Selection.Borders(xlEdgeBottom)
With Selection.Borders(xlEdgeRight)
With Selection.Borders(xlInsideVertical)
With Selection.Borders(xlInsideHorizontal)
End If
這個可以用表格事件來實現:開啟“開發工具”—“Visual Basic—“在右邊的視窗選擇Wroksheet物件和Change過程”—把程式碼複製進進去—然後儲存excel檔案為“
.xlsm
”格式。If Target <> "" Then
Target.Select
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
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End If