【VBA程序】快速找到空白

2018-08-10  本文已影响28人  纪同学说

'该vba检查区域内空白

Sub checkspace()

k = Range("L1").Value

If k > 1 Then

For i = 2 To k

'第二行到第k行,修改为自己的需要的行限制,k值在L1修改

For j = 2 To 3

'第2列到第三列,修改为自己的需要的列限制

Cells(i, j).Select

If Cells(i, j) = "" Then

Cells(i, j).Select

With Selection.Interior

.Pattern = xlSolid

.PatternColorIndex = xlAutomatic

.Color = 65535

.TintAndShade = 0

.PatternTintAndShade = 0

End With

Else

With Selection.Interior

.Pattern = xlNone

'.TintAndShade = O

.PatternTintAndShade = 0

End With

End If

Next

Next

End If

End Sub

上一篇下一篇

猜你喜欢

热点阅读