Andreas Hermle
asked on
Bolding cells where the cell value starts with a single or double digit number followed by a comma
Dear Experts:
For the currently selected cells I would like to apply bold to the cell where
(1) ... the cell value starts with a single digit number, followed by a comma or ...
(2) ... the cell value starts with a double digit number, followed by a comma.
For example:
1, dummy text
2, dummy text
17, dummy text
23, dummy text
The solution could be VBA or maybe - if feasible - conditional formatting.
Thank you very much in advance.
Regards, Andreas
For the currently selected cells I would like to apply bold to the cell where
(1) ... the cell value starts with a single digit number, followed by a comma or ...
(2) ... the cell value starts with a double digit number, followed by a comma.
For example:
1, dummy text
2, dummy text
17, dummy text
23, dummy text
The solution could be VBA or maybe - if feasible - conditional formatting.
Thank you very much in advance.
Regards, Andreas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow, Rgonzo, I am truly impressed. Very nice function! This is real professionalism.
Thank you very much for your swift and professional help.
Regards, Andreas
Thank you very much for your swift and professional help.
Regards, Andreas
ASKER
Hi suvmitra:
ooops, I was too quick to award points. Your code works just fine. I should have refreshed the screen before awarding points. I am really sorry.
I would have split points between the two of you, because both approaches are exactly what I wanted to have.
I am not quite sure what to do in this case?
I could turn to the forum support to ask what to do in this circumstance on the condition that Rgonzo and you agree.
Regards, Andreas
Please
ooops, I was too quick to award points. Your code works just fine. I should have refreshed the screen before awarding points. I am really sorry.
I would have split points between the two of you, because both approaches are exactly what I wanted to have.
I am not quite sure what to do in this case?
I could turn to the forum support to ask what to do in this circumstance on the condition that Rgonzo and you agree.
Regards, Andreas
Please
Option Explicit
Sub CheckAndMake()
Dim rng As Range, cel As Range
Set rng = Range("A1:A100") ' Please change here and update Excel Range as you need
For Each cel In rng
If cel.Value <> "" Then
If IsNumeric(Left(cel.Value, 1)) = True Then
If Mid(cel.Value, 2, 1) = "," Then
cel.Font.Bold = True
End If
If Mid(cel.Value, 3, 1) = "," Then
cel.Font.Bold = True
End If
End If
End If
Next cel
End Sub