+ Reply to Thread
Results 1 to 7 of 7

Concatenate formula

  1. #1
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113

    Concatenate formula

    Hi,
    I try change code numbers like the follow one
    0101010100
    in this
    01-01-01-01-00
    and I know that with this formula
    Please Login or Register  to view this content.
    I can work it out.
    So I create the following code
    Please Login or Register  to view this content.
    but doenst work.
    Can somebody help me.
    Thanks in advance
    Last edited by Jokacave; 01-31-2009 at 09:57 AM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Concatenate formula

    Would this do what you want

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate formula

    Or perhaps something along the lines of:

    Please Login or Register  to view this content.
    So if A1 holds your text string then

    B1: =SPLITTEXT(A1,2,"-")

    that is to say split the text every 2 chars by insertion of delimiter "-"
    Last edited by DonkeyOte; 01-31-2009 at 06:57 AM.

  4. #4
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113

    Re: Concatenate formula

    Thanks both VBA Noob & DonkeyOte
    But again cannot work it out...
    I attached the files maybe will help you
    *First I use the "TesteAccao" to open the one to work that in this case is the "testnovo"
    Attached Files Attached Files

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate formula

    Jokacave, if you want to have the formula calling the UDF stored in each cell in testnovo.xls you would really need to have the function stored in testnovo.xls itself rather than testaccao.xls.

    If you just wish to return the results as static values there are other options open to you... eg:

    Please Login or Register  to view this content.
    I would make the point that all of your routines in TesteAccao.xls should reside in Module1 ... not ThisWorkbook... ThisWorkbook should really be reserved for Workbook level events.

    I've not reviewed your code in full but have altered a few pieces in the above... note I moved all of your Declarations to the top of the Module (Dim) and also altered the Integer types to Long... Integer in 32-bit VBA is converted to Long so it makes sense to simply use Long (if the likes of Byte not guaranteed to be viable)... I also changed the InputBox to Application.InputBox which allows you to add a Type which will restrict data entry to viable types (ie 1 = number) ... you should add further handlers to account for invalid number being entered etc... as I say not complete code but hopefully enough to point you in the right direction.
    Last edited by DonkeyOte; 01-31-2009 at 09:30 AM.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate formula

    I should have added that if your strings are of constant length across any/all files against which you want to apply this format (ie 10 chars etc...) you can just use a Custom Format as provided by VBANoob... I was under the impression that this may not be the case (hence the UDF)... if not use a Format (the UDF is overkill).

  7. #7
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113

    Re: Concatenate formula

    Thank you DonkeyOte for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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