LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Am I Range? ... I object!!!


"John T Ingato" wrote in message
<snip

You definitely need to leave the .address off, as that returns a string
rather than a range.

Your problem is that the code is trying to select a cell on a sheet that is
not activated.

Solution is to insert
Sheets("Stores").activate

Put this in before
Set rStoreRange = FindEndOfDataIn("Col", rCurrentRecord,"range")



To help see the basics, I produced a simplified version of your code, which
all seems to work perfectly - see below

HTH

GB



Public Sub Testit()

Dim MyRange As Range
Set MyRange = Sheets("Sheet3").Range("A1")

Sheets("Sheet3").Activate 'change this to Sheet1 and it will generate your
particular error
Range("E1").Select

Set rStoreRange = FindEndOfDataIn("Col", MyRange, "Range")

Debug.Print rStoreRange.Address

End Sub


Public Function FindEndOfDataIn(Selection As String, StartCell As Range,
Optional ReturnType As String) As Variant

StartCell.Select

Range("F2").Activate

Set FindEndOfDataIn = Range(StartCell, ActiveCell)


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
Working with the range object [email protected] Excel Discussion (Misc queries) 1 November 26th 07 04:29 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Range object to Array object conversion Myrna Larson[_2_] Excel Programming 1 August 1st 03 02:27 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM
Range object to Array object conversion Tom Ogilvy Excel Programming 0 August 1st 03 12:16 AM


All times are GMT +1. The time now is 02:00 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"