+ Reply to Thread
Results 1 to 3 of 3

Navigating with a macro

  1. #1
    Forum Contributor
    Join Date
    12-04-2003
    Location
    Burrton, Kansas USA
    MS-Off Ver
    2003
    Posts
    162

    Navigating with a macro

    Hi!
    What would the code look like for the following:

    I want to navigate to (make active) a specific cell within a named range even if the range definition changes.

    I want to (go to) or make the active cell the last cell in a named range ie. Range "rng1" is A1:A9 and I want the active cell to be A9 but if the range definition changes to A1:A12 I want the code to make A12 the active cell.

    What if the range is defined as A1:D12 is there a way to get to A12 or B12 or A1 or B1 ect.?

    Thanks for any help or direction.

  2. #2
    Kevin B
    Guest

    RE: Navigating with a macro

    The following macro counts the number of cells in the range name MyRange and
    then activates the last cell in that range.

    Sub LastCell()

    Dim r As Range
    Dim l As Long

    Set r = Range("MyRange")
    l = r.Cells.Count

    r.Cells(l).Activate

    Set r = Nothing

    End Sub

    --
    Kevin Backmann


    "Brian Matlack" wrote:

    >
    > Hi!
    > What would the code look like for the following:
    >
    > I want to navigate to (make active) a specific cell within a named
    > range even if the range definition changes.
    >
    > I want to (go to) or make the active cell the last cell in a named
    > range ie. Range "rng1" is A1:A9 and I want the active cell to be A9 but
    > if the range definition changes to A1:A12 I want the code to make A12
    > the active cell.
    >
    > What if the range is defined as A1:D12 is there a way to get to A12 or
    > B12 or A1 or B1 ect.?
    >
    > Thanks for any help or direction.
    >
    >
    > --
    > Brian Matlack
    > ------------------------------------------------------------------------
    > Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
    > View this thread: http://www.excelforum.com/showthread...hreadid=544780
    >
    >


  3. #3
    Forum Contributor
    Join Date
    12-04-2003
    Location
    Burrton, Kansas USA
    MS-Off Ver
    2003
    Posts
    162
    Hi Kevin!
    Thanks for the help. it works great!!

+ 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