Navigating with a macro

  • Thread starter Thread starter Brian Matlack
  • Start date Start date
B

Brian Matlack

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

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

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

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

Thanks for any help or direction
 
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
 
Back
Top