Sunday, August 2, 2009

How can I bold a single word in Excel using Visual Basic?

Microsoft has turned MSDN upside down again and I can't find anything. Those idiots are always re-working MSDN and right now half of Excel is missing. Microsoft's motto seems to be: If it ain't broke, break it.





I need to bold a single word in a cell using Visual Basic. I know how to do it in Excel manually, but I need to be able to program it.





Thanks





Steve

How can I bold a single word in Excel using Visual Basic?
That was correct but not clear





it goes like this





Sheet1.Range( "A1").Characters( 4, 5).Font.Bold = True





Sheet1: is the name of the Sheet in VBA (Not caption)


4: is the number of charactor to start bold from


5: is the length of the text you want it to be bold





You can also use "Underline", "Italic", "Size", etc





Enjoy my profile, I am the VBAXLMan
Reply:With ActiveCell.Characters(Start=10, Length=4).Font


.FontStyle = "Bold"


End With








-------








Where 10 is the location of the first letter and 4 is the length of the word. Not sure why it is showing elipses after the 10, but that should be a comma.

night garden

No comments:

Post a Comment