+ Reply to Thread
Results 1 to 5 of 5

Thread: Returning A Range

  1. #1
    Registered User
    Join Date
    04-18-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    40

    Returning A Range

    Hi,

    I have a very simple query that I'm sure someone will be able to solve in seconds.

    I have a spreadsheet and I'd like to get a specific range returned for use in a later function.

    The range itself starts in cell A3 and extends downwards until the cell just above an empty cell in the same column (A). The trick of course is that the number of cells with data in them may change and hence the position of the empty cell in column A may also change.

    I've attached a spreadsheet with a simple depiction of what I mean.

    Should you have any further questions or queries, please don't hesistate to ask.

    Many thanks in advance for your help,

    Kindest Regards,
    Twills.
    Attached Files Attached Files
    Last edited by twills; 07-19-2010 at 10:17 AM.

  2. #2
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Very Simple - Returning A Range

    Explore 'currentregion' in the VBEditor helpfiles.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Very Simple - Returning A Range

    For example:
        Dim rng As Range
        If Len(Range("A4").Formula) = 0 Then
            Set rng = Range("A3")
        Else
            Set rng = Range("A3", Range("A3").End(xlDown))
        End If

  4. #4
    Forum Guru sweep's Avatar
    Join Date
    04-03-2007
    Location
    Location: Location:
    MS-Off Ver
    3.0
    Posts
    2,472

    Re: Very Simple - Returning A Range

    Something like this?

    Set RangeNeeded = Range(Range("A3"), Range("A3").End(xlDown))
    Please disregard anything in the above post. It may well have been edited without my consent, as has been the case with several posts and threads recently.

  5. #5
    Registered User
    Join Date
    04-18-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Returning A Range

    Guys,

    Thanks for the help, much appreciated.

    Kindest Regards,
    Twills

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0