+ Reply to Thread
Results 1 to 8 of 8

Combine two Private Sub Worksheet_Change VBA codes

  1. #1
    Registered User
    Join Date
    08-30-2017
    Location
    SHEFFIELD,ENGLAND
    MS-Off Ver
    2016
    Posts
    37

    Combine two Private Sub Worksheet_Change VBA codes

    Hi,

    I have been scratching my head all day.

    Can anyone please help or point me in the right direction.

    I have two Worksheet Change codes and I want to combined into one procedure (see below) How can this been done ?

    Please Login or Register  to view this content.
    Thank you in Advance

    Slosh :-)
    Last edited by sloshpuppy; 12-14-2017 at 09:36 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Combine two Private Sub Worksheet_Change VBA codes

    To combine two worksheet change events, you would have to use something different than "exit SUb"

    Please Login or Register  to view this content.
    But in your case I believe this would work for you

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: Combine two Private Sub Worksheet_Change VBA codes

    ... or use the procedure "Workbook_SheetChange (ByVal Sh As Object, ByVal Target As Range)" in the module "ThisWorkbook"

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Combine two Private Sub Worksheet_Change VBA codes

    Quote Originally Posted by porucha vevrku View Post
    ... or use the procedure "Workbook_SheetChange (ByVal Sh As Object, ByVal Target As Range)" in the module "ThisWorkbook"
    Hi Porucha,
    Could you elaborate on this ...?

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: Combine two Private Sub Worksheet_Change VBA codes

    Quote Originally Posted by sloshpuppy View Post
    ...I have two Worksheet Change codes and I want to combined into one procedure...
    For me, it's an attempt to combine procedures from two different sheets. Here, perhaps the more appropriate procedure would be "Workbook_SheetChange (ByVal Sh As Object, ByVal Target As Range)" in the module "ThisWorkbook" ... I think so.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Combine two Private Sub Worksheet_Change VBA codes

    Quote Originally Posted by porucha vevrku View Post
    For me, it's an attempt to combine procedures from two different sheets. Here, perhaps the more appropriate procedure would be "Workbook_SheetChange (ByVal Sh As Object, ByVal Target As Range)" in the module "ThisWorkbook" ... I think so.
    The OP wanted to have more than one worksheet_change event for the same sheet.

  7. #7
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: Combine two Private Sub Worksheet_Change VBA codes

    Maybe, but he clearly didn't write it.
    Well, Englishman ... very sparing in words and temperate/reserved/moderate ...

  8. #8
    Registered User
    Join Date
    08-30-2017
    Location
    SHEFFIELD,ENGLAND
    MS-Off Ver
    2016
    Posts
    37

    Re: Combine two Private Sub Worksheet_Change VBA codes

    Thanks Dave, this is exactly what I was looking for, very much appreciated buddy !!

    Happy Holidays

    Slosh

+ 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 two Private Sub Worksheet_Change
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2016, 03:32 AM
  2. Combine two Private Sub Worksheet_Change(ByVal Target As Range) on same sheet
    By carl2942 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2016, 01:48 AM
  3. [SOLVED] Need help to combine 2 Private Sub Worksheet_Change(ByVal Target As Range)
    By sylvainsyl20 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2016, 11:45 AM
  4. [SOLVED] How to Combine two Private Sub Worksheet_Change ?
    By stoicy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-17-2016, 04:34 PM
  5. Connecting two VBA codes (Private Sub Worksheet_Change(ByVal Target As Range)
    By TinRu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2014, 06:47 AM
  6. Combine two Worksheet_Change Codes
    By otherbobby in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2014, 04:10 PM
  7. 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

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