LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Finding string and color the found string

Hi all,

I tried to find a string in selected cells with the following code with
no success:

Sub Findstr()
Dim myStr As String

myStr = InputBox("Enter word to be searched")
If myStr = "" Then Exit Sub

With Selection.Characters(Start:=InStr(1, ActiveCell.Value, myStr), _
Length:=Len(myStr)).Font
.FontStyle = "Bold"
.ColorIndex = 3
End With
End Sub

Any advice on improving the code is much appreciated.

TIA.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
line input problem-need to return 5 lines after a string is found festdaddy Excel Programming 3 December 8th 05 04:38 PM
Search for a test string and if found insert 'x' in clumn 'A' TCL Excel Discussion (Misc queries) 2 September 21st 05 05:18 PM
Search column - return row found in long text string JayL Excel Programming 1 March 5th 05 03:23 AM
get linenumber when string found in VBE codemodule RB Smissaert Excel Programming 11 October 10th 04 09:56 AM
Highlight found text string in cell? Ed[_18_] Excel Programming 4 June 4th 04 03:07 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"