+ Reply to Thread
Results 1 to 7 of 7

Format certain text in a comment

  1. #1
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Format certain text in a comment

    Hi,

    I have some code that searches for some text (the person who entered the comments name) in comments and removes it. This works fine thanks to help from people on here but the line below in each comment ends up bold. I was hoping someone can help with modify this sub so it first runs through each comment to find the text in question and format to normal/standard. Then it can go through the comments and remove the text without formatting any remaining text bold.

    Originally the code did run through all comments after named were removed and formatted them to standard but some comments have bold text in which i need to remain bold.

    Please Login or Register  to view this content.
    Thanks to all in advance
    Say thanks, click *

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Format certain text in a comment

    Hi,

    I found this in another forum using google (source:http://www.mrexcel.com/forum/excel-q...tml#post222466):
    Please Login or Register  to view this content.
    Regards
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Format certain text in a comment

    Thanks for the suggestion but this code doesn't do the job for me unfortunatly.

    I'm trying to find a way of removing the user name from a comment without it affecting the remaining text in each comment.

    Example

    Comment Before
    A Name:
    Some normal text
    Some Bold Text

    Comment after should be
    Some normal text
    Some Bold Text

    But currently looks like
    Some normal text
    Some Bold Text

    I have found it possible to to use code to find and remove a users name from a comment but after that the remaining text ends up ALL bold/normal. I need the rest of the comment to retain its orginal formatting. I've given up on searches as I always hit a dead end and my lack of knowledge with VB means I am clueless how to modify any code that comes close.

  4. #4
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Format certain text in a comment

    Hi,

    this will remove the username and keep the bold resp. un-bold formatting of your comments:
    Please Login or Register  to view this content.
    Regards

  5. #5
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Format certain text in a comment

    Thanks for this solution which does work for my given example. However it doesn't work for other situations (sorry for not explaining fully).
    If the bold text in a comment is in a different place then the code you have provided doesn't work unfortunatly. Sometimes ends up all bold (say I have three lines of normal text before, this ends up as three bold lines). Other combinations don't seem to work either.

    I was hoping to have something to retain the formatting of the comment regardless of how many lines (max number I think is 6 - excluding username line) and regardless of what the formatting is for that line whether it is normal or bold.

    Appriciate the work behind the codes given so far though, it's made me realise that I best start learning this myself!

  6. #6
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Format certain text in a comment

    hi,

    i just noticed that i forgot to reset the string holding the bold information each time the loop is repeated, my bad.
    Add
    Please Login or Register  to view this content.
    after
    Please Login or Register  to view this content.
    Works for me after the change

    Regards

  7. #7
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Format certain text in a comment

    Spot on now!
    Thank you for your time and help on this, you've made my work a lot less time consuming.

+ 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