Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Question Terri[_2_] New Users to Excel 8 February 23rd 08 12:21 AM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
Looping through range newbie question Frank Rizzo Excel Programming 1 November 4th 04 12:09 AM
Newbie question EdL Excel Programming 2 August 15th 04 10:52 PM


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"