O need a little help with custom classes in VBA...
I do have two classes First one - shift
'.... class k_s
'....
Private pNav As Double
''********************************************** NAV
Public Property Get nav_val() As Double
nav_val = pNav
End Property
Public Property Set nav_val() As Double
nav_val = pNav
End Property
Next class is a plan - will contain the array of the class above:
'...class cPlan
'************* ATTR
Private plan() As k_s
'********* Add - this method is called from the master form to populate the array
Public Sub add_s(pol As k_s)
ReDim Preserve plan(UBond(plan) + 1)
Set plan(UBond(plan)) = pol
End Sub
'------ sorting method Public Sub seradit_polozky()
QSort plan(), 0, UBound(pole) 'serazeny =True End Sub
I would like to adjust the sorting sub of smink so i can se it in the cPlan method to sort my objects (shifts) any time inside.
'********** VBA array sort function?
Private Sub QuickSort(vArray As Variant, inLow As Long, inHi As Long)
Dim pivot As Variant
Dim tmpSwap As Variant
Dim tmpLow As Long
Dim tmpHi As Long
tmpLow = inLow
tmpHi = inHi
pivot = vArray((inLow + inHi) \ 2)
While (tmpLow <= tmpHi)
While (vArray(tmpLow) < pivot And tmpLow < inHi)
tmpLow = tmpLow + 1
Wend
While (pivot < vArray(tmpHi) And tmpHi > inLow)
tmpHi = tmpHi - 1
Wend
If (tmpLow <= tmpHi) Then
tmpSwap = vArray(tmpLow)
vArray(tmpLow) = vArray(tmpHi)
vArray(tmpHi) = tmpSwap
tmpLow = tmpLow + 1
tmpHi = tmpHi - 1
End If
Wend
If (inLow < tmpHi) Then QuickSort vArray, inLow, tmpHi
If (tmpLow < inHi) Then QuickSort vArray, tmpLow, inHi
End Sub
this Sub, so it can sort my objects(k_s) inside the array of (class cPlan) based on nav_val property of the objects inside.
I tried fixing the definition of the function, by adding .nav_val to vArray(xxx).nav_val, pivot.nva_val but I'm error "91 Object variable or WIth block variable not set".
Have you tried to solve similar problem?