• 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.

vba code for vlookup

ganeshm

Member
Hi friends,

Attached here is the excel file, wherein i have used macro code in module.
In cell D2, i have the text written and have the code in place. the code works.

In cell B2, i am trying to make amount and specific text in bold. (pls see D2 for reference), but it doesn't work. kindly guide me.

Regards,
ganeshm
 

Attachments

  • test file.xlsx
    11.4 KB · Views: 8
Sub Bold()
Range("D2").Characters(49, 7).Font.Bold = True
Range("D2").Characters(WorksheetFunction.Find("Fixed", Range("D2").Value, 1), Len("Fixed")).Font.Bold = True
End Sub


The formula i used to change specific text in cell D2 to bold.

I am trying the same with B2, but the formula doesn't work. Kindly advise.
 
You can not change the font partly if the cell contains formula or numeric value.

Those need to be converted constant string value, if you want to change the font partly.
 
Something like
Code:
    With Range("D2")
        .Value = .Value  '<-- convert to constant
        .Characters(49, 7).Font.Bold = True
        .Characters(WorksheetFunction.Find("Fixed", .Value, 1), Len("Fixed")).Font.Bold = True
    End With
 
but i have a problem, the cell having vlookup is a variable. It keep changing as and when any new employee joins.
Therefore, I don't want to keep it as constant. In such a case, is there any other option so that it reads vlookup.
 
Hi friends,
Just a quick question, is it really not possible to apply bold to a specific text in a cell i.e. say B2 for example, holding vlookup formula ??
 
Hi !

As previously yet written several times, no !
Within a formula it's all cell content or nothing …
 
Back
Top