Runs in macro but not in procedure...why?

G

Guest

In trying to code a procdure I want to have range A5 as the starting location
for each sheet (to be used in code later as the active cell for each sheet
when made active.) I was having trouble so I recorded the key stroke as a
macro and it works. I copy the code to a procedure, run it from a command
button and I get the following error msg: Select method of Range Class failed.

Here is the simple code:
Sheets("Sheet1").Select
Range("A5").Select
Sheets("Sheet2").Select
Range("A5").Select

Help is appreciated.
 
L

Leith Ross

Hello Billy B,

I suspect your procedure code is in the General Declarations section of
a Worksheet. Add a Module to your project and place the code there and
it should work fine.

Sincerely,
Leith Ross
 

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

Top