+ Reply to Thread
Results 1 to 4 of 4

Macro using deactivate()

  1. #1
    Registered User
    Join Date
    12-24-2014
    Location
    NY
    MS-Off Ver
    2010
    Posts
    4

    Macro using deactivate()

    Hello everyone!

    I need help to solve this little problem that I have.

    I need a macro that runs when abandoning one sheet. The problem is that this macro refers to shapes or objects that are not on the activate sheet, and an error occured. anyone can help me? Thank You!
    I show below code

    Private Sub Worksheet_deactivate()

    Application.Goto (ActiveWorkbook.Sheets("G.3 damages").Select
    If Range("AA48").Value = "eyes" Then
    ActiveSheet.Shapes.Range(Array("72 Oval")).Select
    Selection.ShapeRange.IncrementLeft -1939.7726771654
    Selection.ShapeRange.IncrementTop 38.5227559055
    End If

    End Sub

    Thanks!

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro using deactivate()

    Hi anicolash,

    If the shapes are on the sheet that you are deactivating, the following may work. It moves the goto to the end of the macro.

    Please Login or Register  to view this content.
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Lewis


    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Macro using deactivate()


    Duplicate thread ! Answered yet in other …

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Macro using deactivate()

    One doesn't need to select to manipulate object. This code assumes that the AA48 being tested is on the sheet being deactivated. IF not, qualify that range as well.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro - Deactivate commandbutton
    By anmck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2009, 01:35 PM
  2. [SOLVED] deactivate macro or LostFocus
    By Harold Good in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-17-2006, 02:10 PM
  3. [SOLVED] How to deactivate cells without macro references
    By Adomas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2005, 06:15 PM
  4. deactivate macro
    By ciquitraque in forum Excel General
    Replies: 0
    Last Post: 03-10-2005, 10:42 AM
  5. deactivate macro
    By ciquitraque in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2005, 07:32 PM

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