Thread
:
function to return a "sub-range"
View Single Post
#
3
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
function to return a "sub-range"
See if this idea helps
Sub lastcell()
For i = 1 To Sheets("yoursheet").UsedRange.Rows.Count
doyourthing
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"fedude" wrote in message
...
I have a range AP4:AQ63 that has data in the top few cells in the range.
The
remaining cells are empty (I use delete to clear them).
I need a routine to read this range and return a smaller range that only
has
non-blank cells in it. For example, if there are only 15 rows filled in
in
the range, the function would return AP4:AQ19.
I have a loop that goes through the range, I just need some help
constructing the range to return. Here is what I have so far (thanks to
snippets I've gotten from this forum):
Function GetSubRange() As Range
Dim r As Range
Set r = Worksheets("Subs").Range("AP4")
Do While Not r = ""
Set r = r.Offset(1, 0)
Loop
GetSubRange = ???
End Function
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett