Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 6 of 6

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

  1. #1
    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. #2
    Join Date
    15th August 2005
    Location
    Mechelen, Belgium
    Posts
    6,006

    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. #3
    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!!

    Sorry for answering my own question!! but thanks for reading anyway.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    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. #5
    Join Date
    15th August 2005
    Location
    Mechelen, Belgium
    Posts
    6,006

    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. #6
    Join Date
    15th August 2005
    Location
    Mechelen, Belgium
    Posts
    6,006

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

    Quote 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


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Select Cells Based Value In Adjacent Column
    By ArtieFish in forum EXCEL HELP
    Replies: 5
    Last Post: January 8th, 2008, 00:47
  2. Select And Copy Cells Based On Values In Row
    By LeonS in forum EXCEL HELP
    Replies: 4
    Last Post: July 11th, 2007, 21:20
  3. Select Range based on Activecell
    By xlite in forum EXCEL HELP
    Replies: 4
    Last Post: May 31st, 2004, 17:09
  4. VBA: Select range in vba based on sheet value
    By rpaulson in forum EXCEL HELP
    Replies: 2
    Last Post: September 19th, 2003, 21:31
  5. Replies: 9
    Last Post: March 24th, 2003, 00:43

Bookmarks

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