+ Reply to Thread
Results 1 to 4 of 4

easy one - select a cell

  1. #1
    Kevin
    Guest

    easy one - select a cell

    Hi

    I want to be able to select a range eg
    Application.Goto Reference:="Asset"

    Once I have done this I want to be able to deduce what the first cell in the
    range is eg "F1". I want to do this so I can reset the range when people add
    to it

    Also is there an easier way to write code to resize the range ie below is
    recorded but I just want to be able to say =range("F1","F11") etc
    ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _
    "=Tables!R2C6:R11C6"


    Thanks

    --
    Kevin

  2. #2
    Dave Peterson
    Guest

    Re: easy one - select a cell

    activesheet.range("f1:f11").name = "asset"

    But you may want to look at using a dynamic range name that can grow and
    contract...

    Debra Dalgleish explains it:
    http://contextures.com/xlNames01.html#Dynamic

    Kevin wrote:
    >
    > Hi
    >
    > I want to be able to select a range eg
    > Application.Goto Reference:="Asset"
    >
    > Once I have done this I want to be able to deduce what the first cell in the
    > range is eg "F1". I want to do this so I can reset the range when people add
    > to it
    >
    > Also is there an easier way to write code to resize the range ie below is
    > recorded but I just want to be able to say =range("F1","F11") etc
    > ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _
    > "=Tables!R2C6:R11C6"
    >
    > Thanks
    >
    > --
    > Kevin


    --

    Dave Peterson

  3. #3
    Mike Fogleman
    Guest

    Re: easy one - select a cell

    Here is one way to resize a named range that has items added:

    Sub test()
    Dim NewRng As Range
    Set NewRng = Range("Asset").CurrentRegion
    ActiveWorkbook.Names.Add Name:="Asset", RefersTo:=NewRng
    End Sub

    The CurrentRegion is all non empty cells that are adjacent (contiguous) with
    named range "Asset"
    Mike F


    "Kevin" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > I want to be able to select a range eg
    > Application.Goto Reference:="Asset"
    >
    > Once I have done this I want to be able to deduce what the first cell in
    > the
    > range is eg "F1". I want to do this so I can reset the range when people
    > add
    > to it
    >
    > Also is there an easier way to write code to resize the range ie below is
    > recorded but I just want to be able to say =range("F1","F11") etc
    > ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _
    > "=Tables!R2C6:R11C6"
    >
    >
    > Thanks
    >
    > --
    > Kevin




  4. #4
    Gary Keramidas
    Guest

    Re: easy one - select a cell

    just some extra info, select used for illustration:

    if you have a range selected, this will select the upper left cell.
    ActiveCell.CurrentRegion.Cells(1, 1).Select

    if you want to select the upper left cell in a range using the name:
    ActiveSheet.Range("Range_Name").Cells(1, 1).Select

    --


    Gary


    "Kevin" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > I want to be able to select a range eg
    > Application.Goto Reference:="Asset"
    >
    > Once I have done this I want to be able to deduce what the first cell in
    > the
    > range is eg "F1". I want to do this so I can reset the range when people
    > add
    > to it
    >
    > Also is there an easier way to write code to resize the range ie below is
    > recorded but I just want to be able to say =range("F1","F11") etc
    > ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _
    > "=Tables!R2C6:R11C6"
    >
    >
    > Thanks
    >
    > --
    > Kevin




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1