Avatar of Flora Edwards
Flora Edwards
Flag for Sweden asked on

Modification of VBA to use scripting dictionary instead of Evaluate(Formula)

I had this question after viewing How to get the same result given by formula vba Scripting Dictionary?.


Rgonzo1971 was so kind helping me, wrapping the formula into Evaluate method to output the result in a cell.

i used debug.print timer in the begging of my code and at the end, for many formulas like this. it takes quite a lot of time.

i was wondering if there is any easy solution with scripting dictionary to extract the same result but not using the formula.

if it is not possible or takes too much time, then i can live with this, otherwise if it is possible for scripting dictionary then it will really make the code faster.   for just one formula, i can replicate for my other formulas. all i need is just for this one formula.

I am not good at coding, but i found use of scripting dictinary very effective and fast.
for example,  VBA to remove duplicate with formula was too slow and with scripting dictionary was many time faster than formula method.

thanks very much for your help.
EE.xlsb
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Flora Edwards

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Flora Edwards

ASKER
Many thanks
Rgonzo1971

shorter
Sub macro1()
For Each c In Range(Sheets("Data").Range("a2"), Sheets("Data").Range("a" & Rows.Count).End(xlUp))
    If (c.Value = 2011 Or c.Value = 2012) And c.Offset(, 1).Value <> 111 And _
            (c.Offset(, 2).Value Like "[5-7]*") Then
        mySum = mySum + c.Offset(, 3).Value
    End If
Next
Sheets("Main").Range("B5") = mySum
End Sub

Open in new window

Flora Edwards

ASKER
many thanks Rgonzo1971
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy