View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default 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


" 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