![]() |
excel macro
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. |
excel macro
Hi Nilesh,
Interesting question. Will every cell that contains the * be 5 characters in length? JF On 27 Nov, 15:51, 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. |
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. |
All times are GMT +1. The time now is 01:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com