+ Reply to Thread
Results 1 to 6 of 6

Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner button

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner button

    I have 2 worksheet_change events. The first works fine. The second is dependent on a spinner button which increase cell t65 by 1 but the code is not executing.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,815

    Re: Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner butto

    I'm not sure what you are trying to do but you can use only one worksheet_change event in any sheet. Secondly, you could tidy up your code quite a bit. You don't have to select a range to copy and paste it. For example:
    Please Login or Register  to view this content.
    could be changed to:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    could be changed to:
    Please Login or Register  to view this content.
    Also you only need to put this code in your macro once at the end:
    Please Login or Register  to view this content.
    I hope this helps.
    Last edited by Mumps1; 12-16-2014 at 03:37 PM.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner butto

    Nowhere in your code does the value in T65 increase by 1.

    What does a "spinner button" mean to you?

    Your code is extremely inefficient and there is so much of it I doubt anyone is going to rewrite it for you. Each .Select - .Copy - .Select - .Paste xlPasteValues can be simplified to this:
    Please Login or Register  to view this content.
    Furthermore. You are going to want to use Application.EnableEvents = False for what you are doing.

  4. #4
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    Re: Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner butto

    I used the recorder for the second part, it is copying many, many, many cells. I have a spin button (form control) separate which increases the value of T65 by 1. I wanted it to trigger the second part of the macro when cell T65 changes.

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner butto

    I used the recorder for the second part, it is copying many, many, many cells. I have a spin button (form control) separate which increases the value of T65 by 1. I wanted it to trigger the second part of the macro when cell T65 changes.
    Your code is already set up to do that. For further analysis on your problem I recommend you submit a copy of you workbook with all sensitive information removed.

  6. #6
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    Re: Worksheet_Change(ByVal Target As Range) not executing Target inc by 1 as spinner butto

    Quote Originally Posted by stnkynts View Post
    Your code is already set up to do that. For further analysis on your problem I recommend you submit a copy of you workbook with all sensitive information removed.
    When I manually change it, it works fine once and then doesn't work again, when spin button changes it, nothing happens at all. Code has been cleaned up

    Please Login or Register  to view this content.
    Last edited by sdl2; 12-16-2014 at 08:08 PM.

+ 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. [SOLVED] Worksheet_Change(ByVal Target As Range) - set to only update when 3 target cells changed?
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2012, 06:40 PM
  2. [SOLVED] 2nd condition: Worksheet_Change(ByVal Target As Range)
    By drawing.blanks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2012, 03:18 AM
  3. Worksheet_CHange (ByVal Target as Range) when target is formula cell
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 07:00 PM
  4. use of Worksheet_Change(ByVal Target As Range)
    By Isaac in forum Excel General
    Replies: 2
    Last Post: 07-07-2006, 02:10 PM
  5. [SOLVED] Worksheet_Change(ByVal Target As Excel.Range)
    By Daggi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2005, 10:05 AM

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