• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Format copy for part of the cell data

Dear All,

I have a set of data as given below

upload_2017-1-20_18-43-14.png

I want to format 'cheque data is given' in red color for all the cells. How can I do that in excel.

Regards,
M. Suresh
 
Try the below code:

Code:
Dim startpos As Byte
    Dim endpos As Byte
    Dim currentvalue As String
    Dim extractvalue As String
    celltrack = 1
    For celltrack = 1 To ActiveSheet.Range("A" & Cells.Rows.Count).End(xlUp).Row
        currentvalue = Range("A" & celltrack).Value
        startpos = WorksheetFunction.Find("(", currentvalue) + 1
        endpos = WorksheetFunction.Find(")", currentvalue)
        extractvalue = Mid(currentvalue, startpos, endpos - startpos)
        If extractvalue = "Cheque Date is given" Then
            Range("A" & celltrack).Characters(startpos, endpos - startpos).Font.ColorIndex = 3
        End If
    Next

Assuming that your values are in column A and you want to format only those cells where the value in the brackets is written as Cheque Date is given
 
Back
Top