+ Reply to Thread
Results 1 to 8 of 8

Go to initial active cell

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Go to initial active cell

    Hi,

    I have a simple macro running goal seek on every Workbook sheet change. When the macro is done it jumps to the changed cell. This is what I would like to avoid.

    My code:
    Please Login or Register  to view this content.
    So my code jumps to cell C11 after every workbook change. I want to avoid that.

    Any thoughts?

    regards,
    Kbka

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Go to initial active cell

    If you want to go back to E77, just add
    Please Login or Register  to view this content.
    before your screenupdating True statement.
    Do you really need that first Range("E77").Select statement?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Go to initial active cell

    Please Login or Register  to view this content.
    Note: this is untested
    Gary's Student

  4. #4
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: Go to initial active cell

    Hi,

    Thanks for the fast reply!

    You're right in the fact that the first Range("E77").Select is redundant. So I've deleted it.

    The thing is that many cells affect the goal seek, and this goes across worksheets. I would like to go back to the cell that I originally was in. I found this which fixes part of the problem

    Please Login or Register  to view this content.
    But this doesn't go back to the initial active worksheet. It goes to worksheet 'sheet11'

    So I need to add something like "SheetRef = ActiveSheet" or something like that?

  5. #5
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: Go to initial active cell

    Quote Originally Posted by Jakobshavn View Post
    Please Login or Register  to view this content.
    Note: this is untested
    I get a run-time error '1004'

    Select method of Range class failed

  6. #6
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: Go to initial active cell

    Quote Originally Posted by kbka View Post
    I get a run-time error '1004'

    Select method of Range class failed
    The error only comes when I go across worksheets. That is if I make a change in sheet11 no error. If I make a change in any other sheet there's an erro.

  7. #7
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: Go to initial active cell

    Quote Originally Posted by Jakobshavn View Post
    Please Login or Register  to view this content.
    Note: this is untested
    Works, I of course just have to ad

    set s=Active sheet

    CODE

    s.select

  8. #8
    Registered User
    Join Date
    06-28-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010, Excel 2011 for mac
    Posts
    82

    Re: Go to initial active cell

    It Works! I of course just have to also ad

    Please Login or Register  to view this content.

+ 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