不知錯在那裡><
dss = 29
ess = 17
sss = 0
Do
If dss = 34 Then ess = ess + 2
If Range(ess & dss).Select = "" Then
Range(ess & dss).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
Range(ess & dss).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
如果堅持要用VBA,請參考
Sub Ex()
Set Rng = Range("A1:B4")
For Each a In Rng
If Not IsEmpty(a) Then a.Interior.Color = 65535 Else a.Interior.Pattern = xlNone
Next
End Sub作者: wqfzqgk 時間: 2010-7-6 00:21
If Range("B6").Value = "" then [a1]=1 正确,后面的可以用cells来选择