+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    04-05-2009
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    44

    Unhappy Error while selecting a range

    I am using the following statement to return to first sheet after completing a 'For Next' loop. This throws an error.

    Code:
    Sheets("Cover_Sheet").Range("A1").Select
    This works when I modify this to -
    Code:
    Sheets("Cover_Sheet").Select
    Range("A1").Select
    I have reinstalled Excel and rebooted several times but still this happens. What's wrong and what should I do? Thanks!

  2. #2
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: Error while selecting a range

    Nothing is wrong. You cannot select a range on a sheet that is not active, so you have to activate that sheet first.
    You could almost certainly rewrite your For...Next loop so that it doesn't change the active sheet when it runs though.
    So long, and thanks for all the fish.

  3. #3
    Registered User
    Join Date
    04-05-2009
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Error while selecting a range

    Thanks romperstomper.
    This looks bit strange not to be able to directly select a range. This may be Excel's fault. Many thanks to you!

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0