What's the RIGHT way to reference named cells in Excel 2013 VBA? (I know I'm messing this up)

StolenKitten picture StolenKitten · Jun 21, 2013 · Viewed 72.8k times · Source

I have a cell (Ok there's a bunch but I'm just looking at one now) named "Classes". It's "C10" by Excel's grid notation.

My code works perfectly when I reference the cell as

Range("C10") = "Value"

But when I use

Classes = "Value"

It just does nothing.

So, what's the correct way to reference a named cell by its name?

Answer

Jon Crowell picture Jon Crowell · Jun 21, 2013

You replace the address with the named range's name:

Range("Classes") = "Value"