Results 1 to 4 of 4

Adding comma to string

Threaded View

  1. #1
    Registered User
    Join Date
    12-09-2011
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Excel 2007
    Posts
    46

    Adding comma to string

    Hey all,
    I need a little help adding commas to this string. When I run this code below I get the result, A-(BCD)-(BCDEF). What i want is A-(B,C,D)-(B,C,D,E,F). I tried adding a join to it but keep getting a type mismatch error. Any help would be appreciated.

    thanks
    jeremy


        
    strArray() = Split("A-BCD-BCDEF", "-")
    For j = LBound(strArray) To UBound(strArray)
    If Len(strArray(j)) > 1 Then
    newStr = newStr & "-(" & strArray(j) & ")"
    Else
    newStr = newStr & strArray(j)
    End If
    Next j
    Last edited by jharaldson; 08-19-2014 at 01:15 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Please Help - split a string having both comma (,) and semicolon(;)
    By Chandan.jha in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2012, 01:53 AM
  2. Comma separated string
    By ESF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2011, 06:39 AM
  3. Comma Separation Indian String with Dr. Cr.
    By aronyo in forum Excel General
    Replies: 4
    Last Post: 11-28-2010, 06:43 AM
  4. dot / comma and string to double conversion
    By snaggy^^ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2006, 04:00 PM
  5. [SOLVED] Macro to find a comma in a string
    By Chuck in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-23-2005, 11:05 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