Excel Button select range

  • Thread starter Thread starter Randal
  • Start date Start date
R

Randal

Why does this work in a macro but not in the code for a button?
"Range("B3:C3").Select"
 
I'm betting that you changed worksheets:

Try something like:

with worksheets("othersheet")
.select
.range("b3:c3").select
....


If your code is for a command button from the controltoolbox tooblar on a
worksheet:

Then unqualified refences like the range refence in this example:

worksheets("othersheet").select
range("b3:c3").select

will refer to the worksheet that holds the code. (The same code in a general
module will use the activesheet.)

And you usually don't have to select the range before you do something with it.
Maybe just work on that range directly???
 
Back
Top