I Need VBA Assistance for EOF

B

Brent E

Good afternoon,

I need to know a VBA command that will look at all cells in Column B until
end of file or EOF. I tried DO UNTIL ... EOF, but didn't seem to work. Is
this valid? Thanks.
 
D

Dave O

It depends on how your data is populated in column B. You could
instruct Excel to evaluate each cell until a blank cell is encountered
(if the data is contiguous), or run for a given number of repetitions.

Here's an example of code that starts at cell B3, moves down a cell and
evaluates the entry in that cell, and stops when it encounters a cell
with the value "stop".

sub Evaluate_Column_B
range("b3").select
do until activecell.value = "stop"
{{{your process here}}}
activecell.offset(1,0).select
loop
end sub
 
D

Dave O

Forgot to mention: make sure you type the word "stop" into a cell at
the bottom of your data, or else this will run for all 65,000 rows in
the tab and then create an error.
 
G

Gord Dibben

Brent

Sub findbottom()
ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Select
End Sub


Gord Dibben Excel MVP
 
M

Myrna Larson

The EOF file command has to do with what it says, "file", i.e. it's for
detecting the end of a text file that you are reading with Input, Line Input,
etc.
 
Top