Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

# Thread: Select a Range based on a value in another two cells

1. I agreed to these rules
Join Date
31st July 2006
Posts
3

## Select a Range based on a value in another two cells

Right, I need to select an area of cells on a sheet, but I need the values to be based on the values of two cells.

Example:

Cell A1 contains "C8"
Cell A2 contains "C12"

I need a piece of code that will select the area "C8:C12" using the ranges of the cells.

If you can help thats fantastic. Thanks in advance!

Excel Video Tutorials / Excel Dashboards Reports

2. ## Re: Select a Range based on a value in another two cells

Hi

use

VB:
```Sub selecting()
Dim rng As Range
Set rng = Range(Range("A1").Value, Range("A2").Value)
rng.Select
End Sub

```
Wigi

Excel Video Tutorials / Excel Dashboards Reports

3. I agreed to these rules
Join Date
31st July 2006
Posts
3

## Re: Select a Range based on a value in another two cells

Sorry! It's okay. I've actually found out how to do it, but for those of you who might need it some time...

I used a concatenate function, to join them,

Using the example from before,

Text1 = A1
Text2 = :
Text3 = A2

I placed this function in cell A3.

Then in the code:

Range(Range("A3)).Select

This will select the range between two points based on two values!!

Excel Video Tutorials / Excel Dashboards Reports

4. I agreed to these rules
Join Date
31st July 2006
Posts
3

## Re: Select a Range based on a value in another two cells

Oh Sorry!!

I didn't know I'd get a reply that quick!! Thanks very much for that. And it's a whole lot better than what I had! haha!

Thanks very much

Excel Video Tutorials / Excel Dashboards Reports

5. ## Re: Select a Range based on a value in another two cells

Why would you use an auxiliary function (CONCATENATE) and cell (A3) if you could do it in the macro, as I showed? You need to use the macro in any case.

Wigi

Excel Video Tutorials / Excel Dashboards Reports

6. ## Re: Select a Range based on a value in another two cells

Originally Posted by barno_xvi
Oh Sorry!!

I didn't know I'd get a reply that quick!! Thanks very much for that. And it's a whole lot better than what I had! haha!

Thanks very much
OK. Topic closed

Excel Video Tutorials / Excel Dashboards Reports

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
porno