I have set Dictionary as an object an added several items to that dictionary, however it seems to be case-sensitive. Is there anyway I can set the dictionary to recognize different versions?
My Code:
Sub Test()
Dim sheet1 As String
Dim Dict As Object
Dim c As Range
Sheet1= "TEST"
Set Dict = CreateObject("Scripting.Dictionary")
Dict.Add "MIKE", 0
Dict.Add "PHIL", 0
Dict.Add "Joe", 0
For Each c In ActiveWorkbook.Worksheets(Sheet1).UsedRange
If Dict.Exists(ActiveWorkbook.Worksheets(Sheet1).Cells(c.Row, c.Column).Value) Then
Dict(ActiveWorkbook.Worksheets(Sheet1).Cells(c.Row, c.Column).Value) = Dict(ActiveWorkbook.Worksheets(Sheet1).Cells(c.Row, c.Column).Value) + 1
End If
Next
Sheet1.Cells(25, 3) = Dict("MIKE")
Sheet1.Cells(25, 3) = Dict("PHIL")
Sheet1.Cells(25, 3) = Dict("Joe")
Set Dict = Nothing
End Sub
So I want to recognize "mike" for MIKE and "Phil" for PHIL etc.
Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…