Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

select first cell range

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

ResolvedVersion 2003

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?

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.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Conditional formatting for cells that return text , not picked up by Go to command

If you have tried to format all cells containing text even those that display text as a result of a formula you may have had difficulty. As Go to command with constant selected does not pick up formulas that result in text.

Then try this. Select the range the formula cells appear in on your sheet. Format, select Conditional Formatting menu. In the dialog box under Condition 1, select "Formula Is" from drop down. Next to it in the Formula Box, enter the formula =Istext(A1. Click Format button , choose desired formatting settings and click OK. To go ahead and apply the conditional formatting click OK to accept

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.