I need help with this error. I created a type for working with rows of data in excel. I've tried this type in both a seperate module and in the same module and I keep getting the error "Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions"
Function
Any idea on what I'm doing wrong?
Code:
Public Type LineData
DataString1 As String
DataString2 As String
MarkedColor As Integer
OnRow As Long
Found As Boolean
End Type
Function
Code:
Public Function LoadData(SheetName As String, CompareColumn As String) As Variant
Dim LastRowSheet As Long
Dim LoadCount As Long
Dim MarkedColor As Integer
Dim MyRange As String
Dim SheetData() As LineData
LastRowSheet = CountRows(SheetName)
ReDim SheetData(LastRowSheet) As LineData
ProgressBar_Form.Set_ProgressBar_Outer 1, LastRowSheet
For LoadCount = 1 To LastRowSheet
MyRange = CompareColumn & LoadCount
MarkedColor = Sheets(SheetName).Range(MyRange).Interior.ColorIndex
With SheetData(LoadCount)
.DataString1 = Sheets(SheetName).Range(MyRange).Value
.OnRow = LoadCount
If MarkedColor <> NoColor Then
.MarkedColor = MarkedColor
Else
.MarkedColor = NoColor
End If
End With
ProgressBar_Form.Update_ProgressBar_Outer LoadCount, "Loading " & LoadCount & _
"/" & LastRowSheet & _
Chr(13) & "Please Wait....."
Next LoadCount
ProgressBar_Form.Hide
LoadData = SheetData
End Function
Any idea on what I'm doing wrong?