Link to home
Create AccountLog in
Avatar of Flora Edwards
Flora EdwardsFlag 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.
Avatar of Rgonzo1971

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Flora Edwards


Many thanks
Avatar of Rgonzo1971

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
Sheets("Main").Range("B5") = mySum
End Sub

Open in new window

many thanks Rgonzo1971