+ Reply to Thread
Results 1 to 5 of 5

Combining VBA code together

  1. #1
    Registered User
    Join Date
    03-19-2024
    Location
    USA
    MS-Off Ver
    2024
    Posts
    5

    Combining VBA code together

    Can someone please help me merge, marry, combine, etc. however you would call it these 2 lines of code together? I know it's not hard to do but I am not smart enough to figure it out by myself.
    FIRST section of code:

    Please Login or Register  to view this content.



    SECOND portion of code:



    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Combining VBA code together

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so. Cross-posts are allowed but you must provide a link to your posts on other sites.

    Please see Forum Rule #7 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    I am providing the link this time because you are a new user.

    https://www.mrexcel.com/board/thread...-help.1255986/
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-19-2024
    Location
    USA
    MS-Off Ver
    2024
    Posts
    5

    Re: Combining VBA code together

    I am so sorry! I will read the rules!

  4. #4
    Registered User
    Join Date
    03-19-2024
    Location
    USA
    MS-Off Ver
    2024
    Posts
    5

    Re: Combining VBA code together

    Anyone? No insight on this request?

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Combining VBA code together

    In both cases you do not show the declaration of the Sub at the top of the code.

    The code is very difficult to read because the variables are not declared, the variable names are cryptic, and there are no comments. Just speaking for myself it would take me way more time just to understand what this code does than I can offer for free. And that doesn't even get into how to combine them.

    If the first sub is Worksheet_Change you can take the same approach as I have done below.

    Here is a quick combination of the two Worksheet_SelectionChange events without needing to understand what any of it does. By doing analysis of the functionality it might be possible to make it more efficient or more readable. It's impossible to test without your file.

    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. Combining two VBA code
    By green400 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-13-2023, 01:03 PM
  2. Combining code
    By Bandito1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2019, 10:06 AM
  3. Combining value in one vba code
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2019, 09:42 PM
  4. [SOLVED] Help combining code
    By thenuguy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-18-2016, 06:26 AM
  5. [SOLVED] combining code
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2015, 07:08 PM
  6. combining code
    By freshfruit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 04:19 PM
  7. Combining Code
    By tuckjoseph in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2009, 09:53 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