Change font color and italicized including brackets update

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

sukisuki

Thread Starter
Joined
Jan 7, 2013
Messages
9
[FONT=&quot]Happy New Year to all.[/FONT]

[FONT=&quot]I'm new here, and this is about Rollin_Again answer to Bibleuser question last July 27, 2012 [/FONT]([FONT=&quot]Replace contents in brackets with Italicized words and certain font color).[/FONT]

[FONT=&quot]The formula works to me but, when I run it, it takes away the brackets (in my case parentheses). What I want is change the font color and italicized including the brackets, so the brackets stay.[/FONT] I'm using Excel 2007

[FONT=&quot]Hoping someone could rewrite the formula for me, I need it very importantly.[/FONT]

[FONT=&quot]Thank you very much.[/FONT]


Here's the formula:

Sub FindBrackets()

Set vFound = Cells.Find(What:="[*]", _
After:=ActiveCell, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)

If Not vFound Is Nothing Then
Do
Call FormatCell(vFound.Address)
Set vFound = Cells.FindNext(vFound)
Loop Until vFound Is Nothing
Else
MsgBox ("Not Found")
End If

End Sub




Sub FormatCell(vAddress As String)

Dim aArray() As String

vCount = 0

Do While InStr(1, Range(vAddress).Value, "[") > 0 Or InStr(1, Range(vAddress).Value, "]") > 0

ReDim Preserve aArray(vCount)

vStart = InStr(1, Range(vAddress).Value, "[") - 1
vEnd = InStr(1, Range(vAddress).Value, "]") - 1

Range(vAddress).Value = Replace(Range(vAddress).Value, "[", "", , 1)
Range(vAddress).Value = Replace(Range(vAddress).Value, "]", "", , 1)

aArray(vCount) = vStart & "," & vEnd

vCount = vCount + 1

Loop

For i = 0 To UBound(aArray)
vStart = CInt(Mid(aArray(i), 1, InStr(1, aArray(i), ",") - 1))
vEnd = CInt(Mid(aArray(i), InStr(1, aArray(i), ",") + 1))

Range(vAddress).Characters(Start:=vStart, Length:=(vEnd - vStart + 1)).Font.Color = -16776961
Range(vAddress).Characters(Start:=vStart, Length:=(vEnd - vStart + 1)).Font.FontStyle = "Italic"

Next i

End Sub
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top