+ Reply to Thread
Results 1 to 7 of 7

How to Combine two Private Sub Worksheet_Change ?

  1. #1
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    How to Combine two Private Sub Worksheet_Change ?

    Hello All

    Could you please help me
    How to Combine the below two Private Sub Worksheet_Change (in the same sheet).

    Please Login or Register  to view this content.
    And

    Please Login or Register  to view this content.

    because it did not works with me in such situation

    appreciated
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,066

    Re: How to Combine two Private Sub Worksheet_Change ?

    I think you'll need to explain more about what you're wanting to do. The first macro essentially says "If the change is in Column H, do something, otherwise quit". The second says "if the change isn't in column N, exit the sub. If it IS in column N, do something". So you have two checks, one for Column H, one for Column N. Which should come first, and how should it work? For instance, I think one of these two things is what you want to do, but I'm not sure which:
    1) if the change is in column H, do something, but if it isn't in column H, then check to see if it's in Column N. If it is, do something, otherwise quit.
    2) if the change is in column N, do something, but if it isn't in column N, then check to see if it's in Column H. If it is, do something, otherwise quit.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: How to Combine two Private Sub Worksheet_Change ?

    Hello stoicy,

    Have you tried ?:

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to Combine two Private Sub Worksheet_Change ?

    dear jomili

    the two codes is not connected to each other, every code is working alone.

    when putting one code in the sheet; everything is working but when I put the two code; it deactivated both codes

    so I need to combine the two codes in proper way
    no matter what is first because they work automatically and separately

  5. #5
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to Combine two Private Sub Worksheet_Change ?

    Dear Winon


    That is what exactly what I need

    It works


    Thank you so mush

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: How to Combine two Private Sub Worksheet_Change ?

    Hi stoicy,

    You are welcome, glad I could help, and thank you for adding to my Reputation.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Thanks.

  7. #7
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to Combine two Private Sub Worksheet_Change ?

    Marked as solved

    Winon

    wish you all the best in your life

+ 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] Combine Private Sub Worksheet_Change(ByVal Target As Range) VBA Code on same worksheet
    By mark_luke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2022, 04:48 PM
  2. Combine Private Sub Worksheet_Change VBA Code on same worksheet
    By stanlelma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2013, 12:42 PM
  3. How do I include two Private Sub Worksheet_Change’s
    By Jessy01 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-16-2013, 12:24 PM
  4. Private Sub Worksheet_Change:MI Summary.
    By Skybeau in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2010, 02:04 AM
  5. Private Sub Worksheet_Change
    By VicM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2008, 01:28 AM
  6. Private Sub Worksheet_Change:do i need to turn them into one?
    By alex1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2007, 06:43 PM
  7. Tab Names-Private Sub Worksheet_Change
    By Tom Hewitt in forum Excel General
    Replies: 2
    Last Post: 03-21-2005, 11:06 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