Forum Discussion
Weaver1967
Jan 09, 2023Copper Contributor
Using new 'spill range' formulas in Excel VBA
I thought it would be useful to use the 'filter' function from Excel in an Excel VBA script. I had a table where I needed the results from one column, dependent on the value of the second column, me...
- Jan 12, 2023I think you need to get rid of the square brackets in the string, the Evaluate function effectively replaces them
Weaver1967
Jan 11, 2023Copper Contributor
That is achingly cool. Never knew that was a thing. Thank you.
Weaver1967
Jan 12, 2023Copper Contributor
Tried this:
Private Sub testfilter()
Dim v As Variant, StrCondition As String, strEval As String
StrCondition = "Shut Down Reason"
strEval = "[filter(causes[listValue],Causes[ListName]=""" & StrCondition & """)]"
For Each v In Evaluate(strEval)
Debug.Print v
Next v
End SubStill getting type mismatch.
- Weaver1967Jan 12, 2023Copper ContributorThat cracked it.
- JKPieterseJan 12, 2023Silver ContributorI think you need to get rid of the square brackets in the string, the Evaluate function effectively replaces them