Italicizing part of a cell

G

Guest

My cell contains several strings, a carriage return, and the more strings.
Iam trying to italicize the strings that follow the carriage return. This is
the code I'm using. Somehow Im usingthe wrong syntax for search butcan figure
it out. Help please or pointers to functions I'm misusing. Thanks

c.offset(RowIndex, 2).Characters(Start:=10, Length:=(Search(Chr(10),
ActiveCell))).Font.FontStyle = "italic"
 
G

Guest

I have entered the length and start as separate lines of code to be as clear
as possible:


Sub Macro2()
Dim l As Long
Dim r As Range
Dim s As String
Dim retrun As String
retrun = Chr(10)
Set r = Selection
l = Len(r)
k = InStr(r.Value, retrun) + 1
r.Characters(Start:=k, Length:=l - k + 1).Font.FontStyle = "Italic"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top