Tom Winchester
Tom Winchester

Reputation: 397

Error using Range.Fomula for SUBTOTAL

I have a function that opens and closes multiple data sources and performs a comparison between the two. All of that is working as intended. Now, I'm trying to add a subtotal cell at the top of one of the columns so that other users can filter the output data. Here's the relevant snippet of the code:

wsOutputData.Range("E1").Fomula = "=SUBTOTAL(9,E3:E" & lngOutputLastRow & ")"

When the procedure gets to this line, I get the following error:

Run-time error '438': Object doesn't support this property or method

I've double and triple-checked that all of my variables are defined (wsOutputData is a Worksheet that works in the line immediately above it, and lngOutputLastRow is a Long variable that's currently evaluated to 25,841).

Am I using the Range.Formula property incorrectly?

Edit: See selected answer below...spelling is hard.

Upvotes: 0

Views: 60

Answers (1)

MatthewD
MatthewD

Reputation: 6761

You have formula spelled wrong..

change

wsOutputData.Range("E1").Fomula = "=SUBTOTAL(9,E3:E" & lngOutputLastRow & ")"

to

wsOutputData.Range("E1").Formula = "=SUBTOTAL(9,E3:E" & lngOutputLastRow & ")" 

Sometimes you have one of those days :)

Upvotes: 4

Related Questions