Error 1004 on Range Select Method

Nyota

New Member
Joined
Jun 7, 2015
Messages
5
Hi all,

I know this problem has occurred here before, but none of the solutions posted has helped me.
I have a few subs, all independent from one another (for now), in the code of one of my worksheets. Now in the last sub I am getting an error "1004 Application- or Object-defined error" when the program reaches the following line:

Code:
ActiveSheet.Range(Cells(1, 1), Cells(2, 2)).Select

Now, my initial code involved some variables in the cell definitions, but after a bit of wriggling around it won't even do the above. The following will work:

Code:
ActiveSheet.Range("A1").Select

But even this is too much:

Code:
ActiveSheet.Range("A1:A2").Select

I'm a bit helpless, because the exact same code works fine in the other macros. I've tried changing the sheet, I've unlocked all my sheets and cells, but this won't go away.

Any help is greatly appreciated.

Regards,
Nyota
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
This happens because of two things:
1) your code is in worksheet module - and not in standard module;
2) the "ActiveSheet" is not the one the code belongs to.
All you need is to put your code into standard module and change "ActiveSheet" to "Sheets("THE_NAME_OF_WORKSHEET")" and call it from worksheet module.
Good luck. :)
 
Upvote 0
Hello Sektor,

oh dear, such an easy fix. It works very well indeed. Lesson learnt for the next time!
Thanks a lot!

Nyota
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top