Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default I Need VBA Assistance looking for End of a file

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. Any
suggestions? Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default I Need VBA Assistance looking for End of a file

Here is some fairly straightforward code. You can use rngCurrentSpot the same
as you would use Activecell.

Private Sub Traverse()
Dim lngLastRow As Long
Dim rngCurrentSpot As Range

lngLastRow = ActiveSheet.Range("A65535").End(xlUp).Row
Set rngCurrentSpot = ActiveSheet.Range("A2")
Do While rngCurrentSpot.Row <= lngLastRow
MsgBox rngCurrentSpot
Set rngCurrentSpot = rngCurrentSpot.Offset(1, 0)
Loop
End Sub

There are lots of other ways to do this that you might want to investigate
including:
SpecialCells(xlLastCell)
UsedRange

HTH

"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. Any
suggestions? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default I Need VBA Assistance looking for End of a file

Don't confuse EOF -- which refers to the end of a disk file -- with the end of
the data in a worksheet column.

On Fri, 25 Feb 2005 14:13:01 -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. Any
suggestions? Thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Requesting Assistance with Embedding Word documents into xcel File Mkate Excel Discussion (Misc queries) 0 November 4th 08 09:32 PM
If Then assistance... Murph Excel Worksheet Functions 6 December 18th 07 06:07 PM
VBA Assistance needed to test for open file in a different direct Brent E Excel Discussion (Misc queries) 2 April 30th 07 11:39 PM
I Need VBA Assistance for EOF Brent E Excel Discussion (Misc queries) 4 February 26th 05 06:00 PM
Assistance in VBA Joe Excel Programming 1 September 1st 04 04:35 PM


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"