View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
syswizard syswizard is offline
external usenet poster
 
Posts: 23
Default problem:Structure with Object reference (TYPE...END TYPE)

I keep getting the dreaded "Runtime Error '91'....
Object Variable or With-block variable not set"

Type RangeTestType
TestCount As Long ' Cell Count
TestRange As Object ' Range RefString variable stores a name.
End Type
Dim retval as RangeTestType
Dim dataRange As Range
Dim lCellcnt As Long
Dim x as Object

Set dataRange = Range("A1:" & "C" & ActiveSheet.Rows.Count)
x = dataRange
lCellcnt = dataRange.Cells.Count
retval.TestCount = lCellcnt
retval.TestRange = x <= THIS STATEMENT TRIGGERS ERROR

When I replace the Object with "Range", I get the exact same error.
Somehow, passing objects within a structure appear to be
problematic....
any help greatly appreciated. (Excel 2003)