Help to fix the code is not case sensitive

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
172
Office Version
  1. 2010
Platform
  1. 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


1674215850855.png


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
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try adding Dic.Comparemode = 1
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top