I had this question after viewing Modification of VBA to use scripting dictionary instead of Evaluate(Formula)
Rgonzo1971 was so kind helping me on the code below. it currently uses offset function. it works if my data columns are static.
sometimes my data columns move around and for that i have dynamic row and dynamic columns named ranges. is it possibe to modify the code so that instead of using offset. it uses the named ranges which is in the attached workbook.
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
Sheets("Main").Range("B2") = mySum