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: 1
Default Function returns Range -- error 91

This function...

Function Range4(R1 As Integer, C1 As Integer, R2 As Integer, C2 As
Integer) As Range
Set Range4 = Range(Cells(R1, C1), Cells(R2, C2))
End Function

.... works fine through the assignment to Range4 (gets the correct
range), but hangs at the End Funciton line with

Run-time error '91':
Object variable or With block variable not set


What am I doing wrong?

I've tried: adding "ActiveSheet." to everything; an auxilliary Range
variable; searching this group.

Thanks. --David.

PS: Anybody know a better way to construct a simple rectangular range
using numeric arguments rather than string addresses. But I'd still
like to know why this function fails. It fails even if I assign a very
simple range to Range4, like ActiveCell.

 
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
IF(AND(OR function returns #VALUE! error Linda Excel Worksheet Functions 3 April 15th 09 06:00 PM
LINEST() function returns error. Albert[_2_] Excel Discussion (Misc queries) 1 October 28th 07 07:53 PM
Find function returns the #VALUE! error value Ken Excel Discussion (Misc queries) 2 October 29th 06 01:59 AM
AVERAGE function returns #DIV/0! error KhaVu Excel Discussion (Misc queries) 7 January 9th 06 07:06 PM
Named range returns 1004 error Stu D. Excel Programming 0 September 3rd 04 09:37 AM


All times are GMT +1. The time now is 08:30 AM.

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"