View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default Last Row In Column..

Mallycat,

Can't thank you enough....your code got me on the right track for what I
need to do...below is the final version that does what I want it to do...I
need to do several different sorts of the data using the Named Range created
below...Sorts and printouts will be activated by coded buttons calling this
code up as required.

As new names are entered/or deleted this code will pick them up, when
called, and expand or contract the Named Range.

Sub NamedRange()

Dim F As Boolean
x = 0

Do While F = False
If Range("A1").Offset(x, 0).Value = "" Then
F = True
x = x - 1
End If
x = x + 1
Loop

ActiveWorkbook.Names.Add Name:="FirstQtr", RefersToR1C1:="=1stTOTALS!R3C1:R"
& x & "C15"
Range("FirstQtr").Select

End Sub

Can't thank you enough....was about ready to pull my hair out working on this.

Have a great day...you just made mine...:)

Don


"Mallycat" wrote:


Not sure exactly what you are doing, but this code will find the number
or rows in your selection. Just change the first cell from A1 to what
ever

Sub findLast()
Dim Found As Boolean
Dim TotalRows as Integer
x = 0
Do While Found = False
If Range("a1").Offset(x, 0).Value = "" Then
Found = True
x = x - 1
End If
x = x + 1
Loop
TotalRows= x
End Sub


--
Mallycat
------------------------------------------------------------------------
Mallycat's Profile: http://www.excelforum.com/member.php...o&userid=35514
View this thread: http://www.excelforum.com/showthread...hreadid=557609