有没有退出/破坏whileVBS/VBA的方法?
以下代码无法按预期工作:
num = 0
while (num < 10)
if (status = "Fail") then
exit while
end if
num = num+1
wend
Run Code Online (Sandbox Code Playgroud) 在下面的命令的帮助下,我能够清除单元格的内容,但不能清除它们的背景颜色.如何清除和设置范围内单元格的背景颜色?
ob9.Range(ob9.Cells(1,StartCol),ob9.Cells(1,maxcolumn)).ClearContents
Run Code Online (Sandbox Code Playgroud)
编辑
我试过以下:
CountFill = objExcel1.Application.WorksheetFunction.CountA(ob9.Rows(1))
CountBlnk = objExcel1.Application.WorksheetFunction.CountBlank(ob9.Rows(1))
TotalColumn= CountBlnk + CountFill
ob9.Range(ob9.Cells(1,CountFill + 1 ),ob9.Cells(1,TotalColumn)).Interior.ColorIndex(-4142) '= xlColorIndexNone
Run Code Online (Sandbox Code Playgroud)
可以一行完成吗?
谢谢