Gruppe
Allgemein
Problem
Wie kann ich eine lange Zeichenfolge analysieren, indem ich in einer zweiten Tabelle ein Liste aller enthaltenen Zeichen mit der Anzahl ihres Vorkommens auflisten lasse?
StandardModule: basMain
Sub Analyse()
Dim iRow As Integer, iCounter As Integer, iRowT As Integer
Dim sTxt As String
Dim bln As Boolean
sTxt = Range("A1").Value
Workbooks.Add
Columns("A:B").NumberFormat = "@"
Columns("A:B").HorizontalAlignment = xlCenter
Range("A1") = "REPORT"
Range("A1").Font.Bold = True
iRow = 1
iRowT = 2
For iCounter = 1 To Len(sTxt)
Do Until IsEmpty(Cells(iRowT, 1))
If Cells(iRowT, 1) = Mid(sTxt, iCounter, 1) Then
bln = True
Exit Do
End If
iRowT = iRowT + 1
Loop
If bln = True Then
Cells(iRowT, 2) = Val(Cells(iRowT, 2)) + 1 & " mal"
Else
iRow = iRow + 1
Cells(iRow, 1) = Mid(sTxt, iCounter, 1)
Cells(iRow, 2) = "1 mal"
End If
bln = False
iRowT = 2
Next iCounter
End Sub