+ Reply to Thread
Results 1 to 6 of 6

Merge two VBA codes in one

  1. #1
    Registered User
    Join Date
    08-13-2023
    Location
    Algeria
    MS-Off Ver
    2007
    Posts
    2

    Merge two VBA codes in one

    I have these two VBA codes, to get the result, I have to put the following excel formula to do the trick : =CCPA(A1)&(MAJUSCULE(A1&MAJUSCULE(RIP(A1)))).
    I want to merge the two together in a function named for example : Account, so by just typing =Account(A1), it will give me the result obtained from the formula : =CCPA(A1)&(MAJUSCULE(A1&MAJUSCULE(RIP(A1))))

    The codes are :

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Our guidelines recommend code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 08-13-2023 at 08:22 AM.

  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: Post how to merge two VBA codes in one?

    There is no function in your code called MAJUSCULE. What is that?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Merge two VBA codes in one


    Hello six strings !

    MAJUSCULE is the local name of the Excel native UPPER worksheet function …

  4. #4
    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: Merge two VBA codes in one

    Merci Marc L!

    Your original formula uses MAJUSCULE redundantly
    Original
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Streamlined
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So the code is:
    Please Login or Register  to view this content.
    UCase is the VBA function for uppercase, so it is not necessary to refer to the worksheet function in VBA.

  5. #5
    Registered User
    Join Date
    08-13-2023
    Location
    Algeria
    MS-Off Ver
    2007
    Posts
    2

    Re: Merge two VBA codes in one

    forget about 'majuscule' it's not needed, I can do without it.
    so the formula will be:
    =CCPA(A1)&(A1&(RIP(A1)))

  6. #6
    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: Merge two VBA codes in one

    Then you can just remove UCase from the code
    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. Merge two codes
    By juriemagic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2019, 07:06 AM
  2. How to Merge Two Worksheet_Change Codes
    By merveileuse in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-09-2019, 04:56 AM
  3. merge vba codes together
    By pejabe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2017, 08:58 AM
  4. Replies: 5
    Last Post: 01-27-2014, 12:20 PM
  5. [SOLVED] Merge 2 vba codes together
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2013, 03:59 AM
  6. Merge codes
    By tofimoon4 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2011, 06:22 AM
  7. [SOLVED] merge with Word How can I get excel to mail merge zip codes plus 4 correctly?
    By Kathy at Sauder Feeds in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-30-2005, 07:05 AM

Tags for this Thread

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