Results 1 to 3 of 3

Remove trailing commas and spaces without changing text color format

Threaded View

  1. #1
    Registered User
    Join Date
    01-11-2019
    Location
    India
    MS-Off Ver
    MS 365
    Posts
    68

    Remove trailing commas and spaces without changing text color format

    Hi,

    I have found below function which removes trailing comma and spaces but it removes my text formatting too.

    Function removetrailcomma(txt As String) As String
        If Right(txt, 1) = " " Or Right(txt, 1) = "," Then
            removetrailcomma = removetrailcomma(Left(txt, Len(txt) - 1))
        Else
            removetrailcomma = txt
        End If
    End Function
    Can some one please help!, as I have thousand's of rows where I have to remove trailing commas and spaces while keeping the text format as it is.

    Ex: Current Cell - Peter(In black font), 1st Rank(In red font),
    Current Code result - Peter(In black font), 1st Rank(In black font)
    Desired result - Peter(In black font), 1st Rank(In red font)

    I have attached a sample file too!..
    Attached Files Attached Files
    Last edited by Kinjal Doshi; 11-24-2020 at 08:15 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Remove numerous trailing commas from text string that contains commas
    By JenSven1 in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2016, 10:19 PM
  2. Replies: 1
    Last Post: 05-23-2016, 11:05 AM
  3. [SOLVED] how do I remove empty spaces trailing a text string?
    By Need_Help in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. how do I remove empty spaces trailing a text string?
    By Need_Help in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. [SOLVED] how do I remove empty spaces trailing a text string?
    By Need_Help in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 12:05 AM
  6. how do I remove empty spaces trailing a text string?
    By Need_Help in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2005, 11:05 PM
  7. how do I remove empty spaces trailing a text string?
    By Need_Help in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2005, 08:05 PM

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