Set a counta function result in a for loop (Macro Excel)

  • Thread starter Thread starter whitebalance
  • Start date Start date
W

whitebalance

Hi,
I'm trying to use a result from a counta() function.
Is it possible to set i.e.
test = counta(F2:F200)
and then use it as boundary for the for loop:
for x = 1 To test?

regards
Kristoffer
 
Hi,

You can do this
test = WorksheetFunction.CountA(Range("F2:F200"))

and then set up a loop like this

For X = 1 To test
' do things
Next

or even like this
For X = 1 To WorksheetFunction.CountA(Range("F2:F200"))
'do things
Next


Mike
 
Back
Top