0

Hi I'm wondering what is the quickest (least memory using) way to check a range of data points to see if the points are valid.

Lets say I have a rng = Range("A1:A100"). I want to write something such that

If c in rng = "N/A Requesting Data..." Then
     x = false
Else
     Application.OnTime Now() + TimeValue("00:00:05"), "refresh" .... etc.    
End if

Can i do this without looping?

4

1 回答 1

1

A1:A100ActiveSheet. 如果没有单元格包含“N/A”作为其文本的一部分,RangeLooksGood则设置为 True。

Sub TestRangeForValidContent()
Dim RangeLooksGood As Boolean

With ActiveSheet
RangeLooksGood = (Application.WorksheetFunction.CountIf(.Range("A1:A100"), "*N/A*") = 0)
End With
If RangeLooksGood Then
     Application.OnTime Now() + TimeValue("00:00:05"), "refresh"
End If
End Sub
于 2013-10-26T14:42:20.287 回答