Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function LoadSubSet(lngSubSet() As Long, lngItems() As Long, intI As Integer)
' Procedure :   LoadSubSet
' Description:  Load all but the Ith element of lngItems into LngSubSet
' Copyright: Chris Greaves Inc.
' Inputs:       A bucket size, a set of item lengths
' Returns:
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls shown below.
    Dim intJ As Integer
    Dim intK As Integer
    If UBound(lngItems, 2) > 0 Then
        ReDim lngSubSet(1, UBound(lngItems, 2) - 1)
        intK = 0
        For intJ = 0 To UBound(lngItems, 2)
            If intJ = intI Then
            Else
                lngSubSet(0, intK) = lngItems(0, intJ)
                lngSubSet(1, intK) = lngItems(1, intJ)
                intK = intK + 1
            End If
        Next intJ
    Else
        ReDim lngSubSet(0, 0)
    End If
'Sub TESTLoadSubSet()
'Dim lngSubSet() As Long
'Dim lngItems() As Long
'ReDim lngItems(5) As Long
'lngItems(0) = 777
'lngItems(1) = 574
'lngItems(2) = 293
'lngItems(3) = 232
'lngItems(4) = 126
'lngItems(5) = 101
'Call LoadSubSet(lngSubSet(), lngItems, 2) ' straightforward call
'Call LoadSubSet(lngSubSet(), lngItems, 0) ' works for leading item
'Call LoadSubSet(lngSubSet(), lngItems, 5) ' works for trailing item
'ReDim lngItems(0) As Long
'lngItems(0) = 777
'Call LoadSubSet(lngSubSet(), lngItems, 0) ' works for single-item array
'
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function LoadSubSet(lngSubSet() As Long, lngItems() As Long, intI As Integer)
' Procedure :   LoadSubSet
' Description:  Load all but the Ith element of lngItems into LngSubSet
' Copyright: Chris Greaves Inc.
' Inputs:       A bucket size, a set of item lengths
' Returns:
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls shown below.
    Dim intJ As Integer
    Dim intK As Integer
    If UBound(lngItems, 2) > 0 Then
        ReDim lngSubSet(1, UBound(lngItems, 2) - 1)
        intK = 0
        For intJ = 0 To UBound(lngItems, 2)
            If intJ = intI Then
            Else
                lngSubSet(0, intK) = lngItems(0, intJ)
                lngSubSet(1, intK) = lngItems(1, intJ)
                intK = intK + 1
            End If
        Next intJ
    Else
        ReDim lngSubSet(0, 0)
    End If
'Sub TESTLoadSubSet()
'Dim lngSubSet() As Long
'Dim lngItems() As Long
'ReDim lngItems(5) As Long
'lngItems(0) = 777
'lngItems(1) = 574
'lngItems(2) = 293
'lngItems(3) = 232
'lngItems(4) = 126
'lngItems(5) = 101
'Call LoadSubSet(lngSubSet(), lngItems, 2) ' straightforward call
'Call LoadSubSet(lngSubSet(), lngItems, 0) ' works for leading item
'Call LoadSubSet(lngSubSet(), lngItems, 5) ' works for trailing item
'ReDim lngItems(0) As Long
'lngItems(0) = 777
'Call LoadSubSet(lngSubSet(), lngItems, 0) ' works for single-item array
'
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1