![]() |
I Need VBA Assistance for EOF
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. |
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 |
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. |
Brent
Sub findbottom() ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Select End Sub Gord Dibben Excel MVP On Fri, 25 Feb 2005 13:39:02 -0800, "Brent E" wrote: 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. |
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. On Fri, 25 Feb 2005 13:39:02 -0800, "Brent E" wrote: 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. |
All times are GMT +1. The time now is 12:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com