+ Reply to Thread
Results 1 to 4 of 4

Disable my 'ByVal Target As Range' within different macro in module

  1. #1
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Disable my 'ByVal Target As Range' within different macro in module

    In my workbook I have a code on one worksheet that runs macros when the value of certain cells changes. I need to be able to clear the contents of those cells within a different code (in a module) without triggering the running of the other macros (but in any other instance they are run). Is there a way to 'disable' the in worksheet macro within my other macro to allow me to do this??

    Bellow is a section of the code on my worksheet:

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Disable my 'ByVal Target As Range' within different macro in module

    Sorry, use a boolean flag,

    so at the top

    Public blnRunWorkSheetChange as boolean


    then set this to be true or false

    have an extra line at the start

    if blnRunWorkSheetChange then

    YOUR CODE

    end if

    on the delete macro, set the blnRunWorkSheetChange to be false, then true after the delete completes.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Disable my 'ByVal Target As Range' within different macro in module

    or use
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Disable my 'ByVal Target As Range' within different macro in module

    Thans guys. I just tried your solution JosephP because it seemed simpler to implement and it worked perfectly so thanks!

    Quote Originally Posted by JosephP View Post
    or use
    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)

Similar Threads

  1. [SOLVED] Cannot trigger macro with Worksheet_Change(ByVal Target As Range)
    By Leo2004a in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-13-2013, 03:01 PM
  2. Worksheet_Change(ByVal Target As Range) does not trigger macro
    By Jay1357 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-18-2013, 06:17 AM
  3. [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
  4. 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
  5. disable Private Sub Worksheet_Change(ByVal Target As Range)
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-06-2011, 05:39 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