vba help - option compare text vs dictionary compare text

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Can we use option compare text at top of module, instead writing dictionary compare text



VBA Code:
Option Compare Text
Sub Dictionary_Compare()

    Dim dict As New Scripting.Dictionary
    
    With dict
       ' .CompareMode = 1 ' Macro gives output if I add this line
        'Option Compare Text .. doesn't working for converting Compare mode, where it is used.
        .Add Range("a2").Value, Range("b2").Value
        Range("E2").Value = .Item(Range("D2").Value)
    End With
End Sub

Below is sample data.

Book11
ABCDE
1FruitCostKeyItems
2Apple5000APPLE5000
3
4Lower Case Key hereUpper case Key here
Sheet1


Thanks
mg
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Yes you can, however putting Option Compare Text at the top of the module will affect all code in that module, rather than just the dictionary.
 
Upvote 0
Hi Fluff,

Thanks for confirmation, as I was not sure on this. ?(y)

Thanks
mg
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,271
Members
448,882
Latest member
Lorie1693

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