Función Partition [VBA]

Devuelve una cadena que indica dónde ocurre un número dentro de una serie de intervalos calculados.

warning

Esta constante, función u objeto se activa mediante la instrucción Option VBASupport 1, colocada antes del código ejecutable del programa en un módulo.


Sintaxis:

Partition( Number, Start, Stop, Interval)

Valor de retorno:

String

Parámetros:

Number: Required. The number to determine the partition.

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

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

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

Ejemplo:

Option VBASupport 1
Option Explicit
Sub Test_Partition
    Dim retStr As String
    retStr = Partition(20, 0, 98, 5)
    print "20:24  el número 20 aparece en el intervalo: " & retStr
    retStr = Partition(20, 0, 99, 1)
    print " 20: 20 el número 20 aparece en el intervalo: " & retStr
    retStr = Partition(120, 0, 99, 5)
    print  "100:  el número 120 aparece en el intervalo: " & retStr
    retStr = Partition(-5, 0, 99, 5)
    print "   : -1 el número −5 aparece en el intervalo: " & retStr
    retStr = Partition(2, 0, 5, 2)
    print " 2: 3 el número 2 aparece en el intervalo: " & retStr
End Sub

¡Necesitamos su ayuda!