Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Working with the range object | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Range object to Array object conversion | Excel Programming | |||
Range object to Array object conversion | Excel Programming | |||
Range object to Array object conversion | Excel Programming |