Select Method of Range class failing???

  • Thread starter Thread starter Peter Bernadyne
  • Start date Start date
P

Peter Bernadyne

Hello,

I keep getting the following error in my macro:

Run-time error '1004':

Select method of Range class failed

When simply trying to select cell A1 in a worksheet of mine. I can'
figure out for the life of me why this would be failing. Here's m
script (literally):

Range("A1").Select

I am simply trying to position the cursor on a worksheet in preparatio
for a possible operation. I have never had this fail on me before an
I can't figure it out now.

Any ideas why this might be happening?

Thanks in advance,

-Pet
 
if your code is in a worksheet module and you're selecting a different
worksheet, try:

with worksheets("othersheetnamehere")
.select
.range("a1").select
end with

You can only select a cell on the activesheet. And an unqualified range behind
a worksheet refers to the sheet that owns the code--not the activesheet.

If you're using xl97 and call the code from a control from the control toolbox
toolbar (like a commandbutton), then add this to the top of your procedure:

activecell.activate

(if the control has the .takefocusonclick property (like the commandbutton),
then change that property to false--this is a bug in xl97 that was fixed in
xl2k.)
 
Thank you very much for your reply. The With..End With seems to hav
worked.

I am calling this using a command button but I happen to be working i
xl2000. I suspected a bug along the lines of what you mentioned fo
xl97, but I guess that's not the case.

Thanks again!

-Pet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top