Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to clean up an excel macro where I was referencing cells directly ("LoopCount = Range("E4").Value") instead of using named cells ("LoopCount = Cell_LoopCount").

  • So I named cell E4 "Cell_LoopCount". Its label is right there in the upper left corner whenever I select cell E4.
  • At the beginning of the macro, I added "Sheets("Data").Select" to make sure I'm operating on the right worksheet,
  • But breaking after "LoopCount = Cell_LoopCount" reveals Cell_LoopCount is empty and LoopCount = 0
  • "LoopCount = Range("E4").Value" still works fine

What obvious thing am I missing?

share|improve this question
up vote 4 down vote accepted

LoopCount = Range("Cell_LoopCount").Value

share|improve this answer
    
OK, I'm checking into the Serious Bonehead Treatment Center as soon as they have an opening. Thanks. – Fred Hamilton Feb 25 '10 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .