+ Reply to Thread
Results 1 to 2 of 2

Format a part of a text working with only value not working with formula result

Hybrid View

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Format a part of a text working with only value not working with formula result

    hi,
    i am using below code to format change text color to a particular part of a text, but this code is working with only value (not formula's result0
    i want to apply this code to formula result

    thank you

    Sub Format_Characters_In_Found_CellASW22()
        Dim Found As Range, x As String, FoundFirst As Range, m As Object
        With CreateObject("VBScript.RegExp")
            .Pattern = "(B{2,3}|N) PT"
            Set Found = Range("H8:H300").Find(What:=" PT", LookIn:=xlValues, LookAt:=xlPart)
            If Not Found Is Nothing Then
                Set FoundFirst = Found
                Do
                    For Each m In .Execute(Found.Value)
                        With Found.Characters(m.firstindex + 1).Font
                            .ColorIndex = 7
                            .Bold = True
                        End With
                    Next
                    Set Found = Range("H8:H300").FindNext(Found)
                Loop Until FoundFirst.Address = Found.Address
            Else
                'MsgBox x & " could not be found.", , " "
            End If
        End With
    End Sub
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Format a part of a text working with only value not working with formula result

    Hi,

    It is not possible to change the colour of part of a formula's result. You would have to replace the formula with its value and then use the code you already have.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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. Replies: 6
    Last Post: 03-28-2017, 09:24 AM
  2. [SOLVED] Conditional format a cell result from Vlookup not working
    By thecdnmole in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2014, 10:55 AM
  3. Replies: 1
    Last Post: 05-27-2014, 02:40 PM
  4. [SOLVED] =mid formula not working/showing result
    By ryan4646 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-30-2013, 06:06 AM
  5. Replies: 2
    Last Post: 05-02-2012, 06:22 AM
  6. [SOLVED] 2nd part of formula not working
    By dbl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2005, 03:05 PM
  7. Working with Rich Text Format
    By Robert Mulroney in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-12-2005, 08: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