美文网首页
【VBA程序】快速找到空白

【VBA程序】快速找到空白

作者: 纪同学说 | 来源:发表于2018-08-10 21:06 被阅读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

相关文章

网友评论

      本文标题:【VBA程序】快速找到空白

      本文链接:https://www.haomeiwen.com/subject/denlbftx.html