Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 172
- Office Version
- 2010
- Platform
- Windows
Hello everyone. I have used a piece of code to filter row names and add count from a string. The current code is case sensitive. I want to correct that I don't need to be case sensitive, so I can edit the paragraph. Please everyone help. Sincerely thank
VBA Code:
Sub Testcode()
On Error Resume Next
Dim Dic As Object, dArr As Variant, arr As Variant, Tmp As Variant, s As Variant
Dim i As Long, J As Integer, K As Long, ik As Long, key As String, b As Long
Set Dic = CreateObject("Scripting.dictionary")
dArr = Range("A6:A14").Value ' input
ReDim arr(1 To UBound(dArr), 1 To 3)
For i = 1 To UBound(dArr)
Tmp = Split(dArr(i, 1), ";")
For J = LBound(Tmp) To UBound(Tmp)
s = Split(Tmp(J), "*")
If UBound(s) = 2 Then
key = s(0)
If Not Dic.Exists(key) Then
K = K + 1
Dic.Add key, K
arr(K, 1) = key
End If
ik = Dic.Item(key)
arr(ik, 2) = arr(ik, 2) + CDbl(s(1))
End If
Next J
Next i
Range("C6:E27").ClearContents
Range("C6:E27").Resize(K) = arr ' output
End Sub