Public Sub PassMyHumbleData()
On Error goto Err_PassMyHumbleData
Dim MyData() as TGIF
Dim lIndex as Long
Call GatherData(MyData(), lIndex)
Call PassDataToSummary(MyData(), lIndex)
'We can cross this bridge later -- after you have gathered the data
' you open the summary workbook exclusively..or wait
' then find the key line and pass the data from the array to the workbook
Exit_PassMyHumbleData:
Exit Sub
Err_PassMyHumbleData:
'Call ErrHandler("PassMyHumbleData routine",Err.Number, Err.Description)
Resume Exit_PassMyHumbleData
End Sub
Public Sub GatherData(ByRef MyData() as TGIF, ByRef lIndex as Long)
On Error goto Err_GatherData
Dim sRange as String
Dim i as Long
Range("A1").Select
sRange = ActiveCell.CurrentRegion
Range(sRange).Sort Key1:=Range("A2"), _
Order1:=AscendingHeader:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
i = 1
While Not(IsEmpty(ActiveCell.Offset(i,0).Value))
lIndex = lIndex + 1
Redim Preserve MyData(lIndex)
With MyData(lIndex)
.sThis = ActiveCell.Offset(i,0).Value
.sThat = ActiveCell.Offset(i,1).Value
.sTheOtherThing = ActiveCell.Offset(i,2).Value
End With
i = i +1
Wend
Exit_GatherData:
Exit Sub
Err_GatherData:
'Call ErrHandler("GatherData routine",Err.Number, Err.Description)
Resume Exit_GatherData
End Sub