![]() |
keeping a range a range object
I like assigning data kept in a range to a variant array where possible. I
see that when the range consists of only a single cell, the variant takes on the value of the cell and does not become an array (which makes sense). I just don't know how to keep it an array. Sample code below: Thanks! Private Function IDataStorageConnection_Connect() As Boolean Dim v As Variant v = DataRng <------ this ia an Xl data range MemoryStorage.VariantArray = v MemoryStorage.IMemoryStorage_PopulateMemory End Function |
keeping a range a range object
Private Function IDataStorageConnection_Connect() As Boolean
Dim v As Variant Dim DataRng As Excel.Range Set DataRng = Range("B5") If DataRng.Count = 1 Then ReDim v(1 To 1) As Variant v(1) = DataRng.Value Else v = DataRng.Value End If MsgBox IsArray(v) ' MemoryStorage.VariantArray = v ' MemoryStorage.IMemoryStorage_PopulateMemory End Function -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Eric Fingerhut" wrote in message I like assigning data kept in a range to a variant array where possible. I see that when the range consists of only a single cell, the variant takes on the value of the cell and does not become an array (which makes sense). I just don't know how to keep it an array. Sample code below: Thanks! Private Function IDataStorageConnection_Connect() As Boolean Dim v As Variant v = DataRng <------ this ia an Xl data range MemoryStorage.VariantArray = v MemoryStorage.IMemoryStorage_PopulateMemory End Function |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com