ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   html tags with a cell (https://www.excelbanter.com/excel-programming/285674-html-tags-cell.html)

dan

html tags with a cell
 
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.

No Name

html tags with a cell
 
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.


jaf

html tags with a cell
 
Characters Property Example

This example formats the third character in cell A1 on Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.




No Name

html tags with a cell
 
You, the man!

Can I apply a format to any string or just to the
contents of a range???

Thanks


-----Original Message-----
Characters Property Example

This example formats the third character in cell A1 on

Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.



.


Colo[_38_]

html tags with a cell
 
Hello dan,

Here is a test code what I wrote(for fun!). :D
Try input text in a cell with <b </b Tags.



Code:
--------------------

Option Explicit

'Written by Colo 18 Dec 2003

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
BoldWithTag Target
End Sub

Private Sub BoldWithTag(ByVal Target As Range)
Dim c As Range
Dim blnFlag As Boolean
Dim i As Long, st As Long, ed As Long
Dim Start() As Long, Length() As Long
If Target.Rows.Count = Rows.Count Then Exit Sub
If Target.Columns.Count = Columns.Count Then Exit Sub
For Each c In Target
With c
Do
st = InStr(1, .Value, "<b", 1)
If st = 0 Then Exit Do
ed = InStr(st, .Value, "</b", 1)
If ed = 0 Then Exit Do
blnFlag = True
.Value = Left(.Value, st - 1) & _
Mid(.Value, st + 3, ed - st - 3) & _
Right(.Value, Len(.Value) - ed - 3)
i = i + 1
ReDim Preserve Start(1 To i): ReDim Preserve Length(1 To i)
Start(i) = st: Length(i) = ed - st - 3
Loop
If blnFlag Then
For i = LBound(Start) To UBound(Start)
c.Characters(Start(i), Length(i)).Font.Bold = True
Next
End If
st = 0: ed = 0: i = 0: Erase Start: Erase Length: blnFlag = False
End With
Next
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/


Colo[_39_]

html tags with a cell
 
Place that code in ThisWorkbook module please!


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

html tags with a cell
 
Any object which has the characters property and supports Rich Text
Formatting. For example, the text of cell comments, text in the textbox
from the drawing toolbar.

--
Regards,
Tom Ogilvy

wrote in message
...
You, the man!

Can I apply a format to any string or just to the
contents of a range???

Thanks


-----Original Message-----
Characters Property Example

This example formats the third character in cell A1 on

Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.



.





All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com