ECebJ‖

B7UPn‖Partition Function [VBA]

LDTcg‖Returns a string indicating where a number occurs within a calculated series of ranges.

warning

R9TFi‖This constant, function or object is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.


FVEx2‖Syntax:

Hd3VE‖Partition( Number, Start, Stop, Interval)

bBBqF‖Return type:

String

WADQ4‖Parameters:

EXFRi‖Number: Required. The number to determine the partition.

HXMue‖Start: Required. An integer number defining the lower value of the range of numbers.

A4Hit‖Stop: Required. An integer number defining the highest value of the range.

evEzB‖Interval: Required. An integer number that specifies the size of the partitions within the range of numbers (between Start and Stop).

EFSA4‖Example:


        Option VBASupport 1
        Option Explicit
        Sub Test_Partition
            Dim retStr As String
            retStr = Partition(20, 0, 98, 5)
        FAJ4h‖    print "20:24  the number 20 occurs in the range: " & retStr
            retStr = Partition(20, 0, 99, 1)
        i4oqM‖    print " 20: 20 the number 20 occurs in the range: " & retStr
            retStr = Partition(120, 0, 99, 5)
        ipzJN‖    print  "100:  the number 120 occurs in the range: " & retStr
            retStr = Partition(-5, 0, 99, 5)
        mSCDc‖    print "   : -1 the number -5 occurs in the range: " & retStr
            retStr = Partition(2, 0, 5, 2)
        NLrce‖    print " 2: 3 the number 2 occurs in the range: " & retStr
        End Sub