+ Reply to Thread
Results 1 to 2 of 2

newbie range question

  1. #1

    newbie range question

    Hello,

    I am new to vba and want to write a function that takes a range of
    cells as the argument. In VBA I want to be able to mostly access the
    value in the first cell, and the value in the last cell. Do I want to
    use the 'range' type for this? By playing around, it seems ".value"
    gives me the value in the first cell. Is there a way to get the value
    in the last cell of the range?

    thanks for any help,
    scott


  2. #2
    Jim Thomlinson
    Guest

    RE: newbie range question

    A range object should work for you. What you need is to access the item to
    select the appropraite cells, something like this...

    dim rng as Range

    set rng = Sheets("Sheet1").Range("A1:C10")

    with rng
    msgbox .value 'This one you know about
    msgbox .item(.count).value 'The last item in the range
    end with
    --
    HTH...

    Jim Thomlinson


    "[email protected]" wrote:

    > Hello,
    >
    > I am new to vba and want to write a function that takes a range of
    > cells as the argument. In VBA I want to be able to mostly access the
    > value in the first cell, and the value in the last cell. Do I want to
    > use the 'range' type for this? By playing around, it seems ".value"
    > gives me the value in the first cell. Is there a way to get the value
    > in the last cell of the range?
    >
    > thanks for any help,
    > scott
    >
    >


+ 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