LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default excel macro

Sub Highlight_Word()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
On Error GoTo endit
Mylen = Len("*")
Set rng = ActiveSheet.UsedRange
rng.Cells.Font.ColorIndex = 0
For Each Cell In rng
start_str = InStr(Cell.Value, "*")
If start_str Then
Cell.Characters(start_str, Mylen).Font.ColorIndex = 3
End If
Next Cell
endit:
End Sub

Will color only the first occurrence of * in a cell


Gord Dibben MS Excel MVP

On Thu, 27 Nov 2008 07:51:27 -0800, Nilesh Bhuvad wrote:

if in cell(a1).value = "1544*". and in cell(a2).value = "4144".
How to write syntax if cell value containing character "*", then only "*" will become red in colour and other character of the cell will remain as it is.


 
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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


All times are GMT +1. The time now is 05:36 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"