+ Reply to Thread
Results 1 to 3 of 3

refer to last cell in worksheet?

  1. #1
    svh646
    Guest

    refer to last cell in worksheet?

    I'd like to find a generic way to specify the entire data range in a
    worksheet (without knowing how many rows or columns are in the worksheet).

    Is there a way to refer to the last cell in a worksheet (not just a specific
    row or column)? I see how one can use GO TO... to select the last cell, but
    I can't find a way to refer to the last cell in a formula.

    Alternatively, is there an easy way to identify the last (rightmost)
    non-blank column in a worksheet? I see how COUNTA could be used to identify
    a non-blank column, but is there a way to identify the last non-blank column,
    or at least the first?

    Basically, I'd like to use INDEX in one worksheet to find data in another
    worksheet and don't know how to specify a generic range that will work
    regardless of the number of columns (the number of rows is much less
    important).

    Thanks in advance.

  2. #2
    Sasa Stankovic
    Guest

    Re: refer to last cell in worksheet?

    If you're using VBA then this might help:
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    -this way you will select entire range which has data in row 1.
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    -this way you will select entire range which has data in column A.

    But if you need huge area because there is great table than this code miught
    help:
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    -this way you have selected complete table (no matter how many rows or
    columns are there)
    and if you need to tell excel that this range has name (for use in functions
    or for copy or cur...):
    Dim some_range As Range
    Set some_range = Selection


    Now, you can do whatever you want with range name "some_range"...

    "svh646" <[email protected]> wrote in message
    news:[email protected]...
    > I'd like to find a generic way to specify the entire data range in a
    > worksheet (without knowing how many rows or columns are in the worksheet).
    >
    > Is there a way to refer to the last cell in a worksheet (not just a
    > specific
    > row or column)? I see how one can use GO TO... to select the last cell,
    > but
    > I can't find a way to refer to the last cell in a formula.
    >
    > Alternatively, is there an easy way to identify the last (rightmost)
    > non-blank column in a worksheet? I see how COUNTA could be used to
    > identify
    > a non-blank column, but is there a way to identify the last non-blank
    > column,
    > or at least the first?
    >
    > Basically, I'd like to use INDEX in one worksheet to find data in another
    > worksheet and don't know how to specify a generic range that will work
    > regardless of the number of columns (the number of rows is much less
    > important).
    >
    > Thanks in advance.




  3. #3
    svh646
    Guest

    Re: refer to last cell in worksheet?

    Thanks, Sasa. I was trying to stay away from VBA on this one and was looking
    for an easy way to specify all the data in a worksheet for an INDEX command,
    but I think I may be better off taking a different approach.


    "Sasa Stankovic" wrote:

    > If you're using VBA then this might help:
    > Range("A1").Select
    > Range(Selection, Selection.End(xlToRight)).Select
    > -this way you will select entire range which has data in row 1.
    > Range("A1").Select
    > Range(Selection, Selection.End(xlDown)).Select
    > -this way you will select entire range which has data in column A.
    >
    > But if you need huge area because there is great table than this code miught
    > help:
    > Range("A1").Select
    > Range(Selection, Selection.End(xlToRight)).Select
    > Range(Selection, Selection.End(xlDown)).Select
    > -this way you have selected complete table (no matter how many rows or
    > columns are there)
    > and if you need to tell excel that this range has name (for use in functions
    > or for copy or cur...):
    > Dim some_range As Range
    > Set some_range = Selection
    >
    >
    > Now, you can do whatever you want with range name "some_range"...
    >
    > "svh646" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'd like to find a generic way to specify the entire data range in a
    > > worksheet (without knowing how many rows or columns are in the worksheet).
    > >
    > > Is there a way to refer to the last cell in a worksheet (not just a
    > > specific
    > > row or column)? I see how one can use GO TO... to select the last cell,
    > > but
    > > I can't find a way to refer to the last cell in a formula.
    > >
    > > Alternatively, is there an easy way to identify the last (rightmost)
    > > non-blank column in a worksheet? I see how COUNTA could be used to
    > > identify
    > > a non-blank column, but is there a way to identify the last non-blank
    > > column,
    > > or at least the first?
    > >
    > > Basically, I'd like to use INDEX in one worksheet to find data in another
    > > worksheet and don't know how to specify a generic range that will work
    > > regardless of the number of columns (the number of rows is much less
    > > important).
    > >
    > > Thanks in advance.

    >
    >
    >


+ 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