EOF general usage

  • Thread starter Thread starter pvdalen
  • Start date Start date
P

pvdalen

Howdy,

I have a sheet in which I want to run a macro to cycle through the sheet and
perform some operations. Well, I guess that's pretty obvious......anyway,
the number of rows will not be the same from use to use, so I wanted to loop
the file with

Do While Not EOF

but, I get an "Argument not optional" message. I was hoping that since the
data to be parsed is in the sheet itself that I wouldn't have to open it as a
file or a recordset and use EOF as a function of those, but it looks like I'm
wrong? Can someone educate me, please?

Oh, the reason I'm shying away from
Cells(Rows.Count, column).End(xlUp).Row
is that it's not clear what the lowest limit of each column might be. I
just might end up using that on a few columns and going with the lowest
number....

Thanks very much.
 
try this
dim rng as range
set rng=activesheet.usedrange
for n= 1 to rng.rows.count
do your stuff
next
 

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