我创建了一个宏,该宏在未填充的每个单元格周围创建边框。然后,我想运行一个宏,该宏一旦被填充就将其删除。
我已经附上了创建边框的代码
Sub AddBorders()
Dim Rws As Long, Rng As Range, c As Range
Rws = Range("A2:E50" & LastRow).SpecialCells(xlCellTypeLastCell).Row
Set Rng = Range("A2:E50" & LastRow)
For Each c In Rng.Cells
If c = "" Then
With c.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 3
End With
End If
Next c
End Sub
用户进入该字段后,单元格周围的红色边框就会消失。