• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Newbie:What am I doing wrong

adamuce

Member
Hi,

I have just started to use Macros. I hope I can get assistance from the kind people of this community.

Did my first tutorial.

Objective: To move to sheet2 and select cell c5 I put the following in the module in VBA:
Sheets("sheet2").Range("C5").Select

I wanted to know why I getting the error: select method of range class failed

TIA
 
Hi,​
as a cell can be activated / selected only if its sheet is active …​
… so when the sheet is not active rather than Select just use Application.Goto or​
add the Sheet.Select codeline before to select a cell, whatever, to see both in VBA help …​
 
Thanks for the response. Yes it did work when I was on sheet2.

The reason I went down this path is the tutor showed a few other examples before and I thought I could add both of them together.

'Select a cell
Range("C2").Select

'Navigate to another workseet
'Sheets("Sheet2").Activate
 
Last edited by a moderator:
adamuce
This is same as with eg a real book:
If You should read text from book page 12 line 5 ...
1) You should get a book
2) You should open page 12
3) You should look line 5
You will do it step-by-step ...
... except ... if that a book was in front of You and opened from page 12 ... then You could look at once line 5.
 
Back
Top