LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default function to return a "sub-range"

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find a textstring in a "Range" - and then return a value iftextstring is found. HH[_3_] Excel Programming 6 January 29th 08 05:05 PM
function to return day in the form "Monday", "Tuesday" etc given . MTro Excel Worksheet Functions 2 October 3rd 07 09:49 AM
Check if cells contain the word "Thailand", return "TRUE" ali Excel Worksheet Functions 7 September 14th 07 09:53 AM
"No RETURN() or HALT() function found on macro sheet." Will Excel Worksheet Functions 2 January 4th 07 10:10 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"