+ Reply to Thread
Results 1 to 2 of 2

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

  1. #1
    Billy B
    Guest

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

    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.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1