select first cell range
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Select first cell of a range

Select first cell of a range

resolvedResolved · Low Priority · Version 2003

replyReply Thu 26 Feb 2009, 00:13Delegate Scott said...

Scott has attended:
Excel VBA Intro Intermediate course

Select first cell of a range

Hi,

If the user selects a given range, for example , B3:B9, how can I easily work out the first of the range - i.e. B3?

For upcoming training course dates see: Pricing & availability

replyReply Fri 17 Apr 2009, 10:07Trainer Stephen said...

RE: Select first cell of a range

Hi Scott

Thanks for your question, and first let me apologise for the delay in responding.

The following code will carry out the action you require. it assigns the first cell of the selected range to a range variable and then displays that cell's address in a message box

Dim rngMyRange As Range


Set rngMyRange = Selection

MsgBox rngMyRange.Cells(1, 1).Address


Hope this is useful

Regards

Stephen

Thu 23 Apr 2009: Automatically marked as resolved.

 

Please browse our web site to find out more about
application development excel and other Microsoft training courses.

Excel tip:

LARGE and SMALL functions and their uses

Two of Excel's most common functions are the MAX and MIN functions which will display the largest (MAX) or smallest (MIN) value in a series. What if you need the 2nd or 3rd largest or smallest values instead of the largest or smallest?

The =LARGE(array,n) returns the nth largest value of a series.

The =SMALL(array,n) function returns the nth smallest value of a series.

In both functions, 'n' represents the order of the number you want to display. For example, putting in 2 as n will give you the second highest number; putting in 3 as n will give you the third highest number.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard