+ Reply to Thread
Results 1 to 3 of 3

I Need VBA Assistance looking for End of a file

  1. #1
    Brent E
    Guest

    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. #2
    Jim Thomlinson
    Guest

    RE: 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. #3
    Myrna Larson
    Guest

    Re: 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"
    <BrentE@discussions.microsoft.com> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1