|  
                                             
	Hallo, 
	ich hoffe, ich habe die Anforderung richtig verstanden. 
	Die folgende Funktion sollte die von die gewünschte Aufgabe erfüllen: 
Option Explicit
Sub test()
    Dim values(5) As Byte
    values(0) = 25  '//11001
    values(1) = 50  '//110010
    values(2) = 100 '//1100100
    values(3) = 150 '//10010110
    values(4) = 200 '//11001000
    values(5) = 255 '//11111111
    
    '//erwartet: 001001001011011
    Debug.Print get_Bitsequenz(values(), 2, 3, 15)
End Sub
'//Parameter
'//values       | ein Array vom Typ Byte mit beliebiger Länge
'//startByte    | Gibt die Position des ersten auszuwertenden Bytes im Array an (0 basiert)
'//startBit     | Gibt die Position des ersten Bits im startByte an (1 basiert)
'//anzahlBits   | Anzahl der Bits, die zurückgegeben werden
Public Function get_Bitsequenz(ByRef values() As Byte, startByte As Integer, startBit As Byte, anzahlBits As Byte) As String
    If startByte > UBound(values()) Then
        MsgBox "'startByte' in Array nicht vorhanden.", vbExclamation
        Exit Function
    End If
    
    Dim sValues() As String
    Dim i As Integer
    Dim s As String
    ReDim sValues(UBound(values()))
    
    For i = 0 To UBound(values())
        sValues(i) = ByteToBit(values(i))
    Next i
    
    If Len(sValues(startByte)) < startBit Then
        MsgBox "'startBit' ist größer als die Bitlänge.", vbExclamation
        Exit Function
    End If
    
    i = startByte
    Do While Len(s) < anzahlBits And i <= UBound(sValues)
        If i = startByte Then
            s = s & Mid(sValues(i), startBit, Len(sValues(i)) - startByte)
        Else
            s = s & sValues(i)
        End If
        i = i + 1
    Loop
    
    If Len(s) < anzahlBits Then
        MsgBox "Zu wenig Bits vorhanden.", vbExclamation
        Exit Function
    End If
    
    get_Bitsequenz = Left(s, anzahlBits)
End Function
Private Function ByteToBit(ByVal v As Byte) As String
    Dim s As String, e As Byte
    e = v
    
    Do While Not e = 0
        s = s & CStr(e Mod 2)
        e = CByte(Int(e / 2))
    Loop
    
    ByteToBit = StrReverse(s)
End Function
	Ausgabe im Direktbereich: 
	  
	  
	Ich hoffe, dass dir das weiterhilft. 
	Viele Grüße 
     |