RE: CHANGING A TEXTBOX SUBSTRING TO RED. KNOWING WHERE TO START AND STOP...

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
884
Office Version
  1. 365
Platform
  1. Windows
Title self explanatory. Is there a way to do the following:
? i.e., 3 Jesus answered and said to him, (start red text font)"Truly, truly, I say to you, unless one is born again he cannot see the kingdom of God." (end red text font) John 3:3 (NASB)
[bolded just to indicate substring to change to red.

In traditional Bible software apps, Jesus words in red are between quotes except for fhe KJV, in which His words are not between quotes. To me, the start and ending
of the red substring would be between the starting and ending quotes, if this helps any. I can do this, but it colors the entire text, not just a string portion:
Code:
x = Me.TextBox6.Value
With Worksheets("Sheet2").Range("E1:E31103")
    Set c = .Find(x, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
rw = 1
firstAddress = c.Address
Do
Worksheets("Sheet2").Select
c.Select
Range(Cells(c.Row, 2), Cells(c.Row, 7)).Copy Destination:=Sheets("RESULT").Range("B" & rw) 'search just KJV column 6
                rw = rw + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Rowno = Sheets("RESULT").Range("B1").End(xlDown).Row
lastrow = Sheets("RESULT").Range("B" & Rows.count).End(xlUp).Row
Me.TextBox7.Value = lastrow & "  verses"
'If TextBox1.Text = "Jesus said to him" OR "Jesus answered and said" OR... Then  ' as expected this will change 
USERFORM1.TextBox1.ForeColor = RGB(255, 0, 0) '----> sort of works, but this colors entire search result, NOT just His words
'End If

To me, a possible solution, would just be to change the text substring to red if (1) the word Jesus appears and (2) some characters
AFTER look for a "(quote) , begin string text color and end it at "(quote). Would, could this be done with instr, Len, TEXT and substr functions?

Thanks for anyone's help.
cr



Thanks for any guidance you can provide.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
replying as "bump" after no response per MVP Moderator;
re: difficulty in figuring out how to change part of a textbox string to red
cr
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top