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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top