Quote:
Originally Posted by Dave Peterson
In your original post, you used a format of dd/mm/yyyy. In this example, you
lost the leading 0's in the day and only used two digit years.
This will work if you really use a format of dd/mm/yyyy. (But remember, you
have to be formatting values--not formulas--formulas can't use this kind of
character by character formatting.)
Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range
Dim iCtr As Long
Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Selection, _
Selection.Cells.SpecialCells(xlCellTypeConstants, xlTextValues))
On Error GoTo 0
If myRng Is Nothing Then
MsgBox "No constants"
Exit Sub
End If
For Each myCell In myRng.Cells
For iCtr = 1 To Len(myCell.Value)
If Mid(myCell.Value, iCtr, 10) Like "##/##/####" Then
With myCell.Characters(Start:=iCtr, Length:=10).Font
.Name = "Arial"
.Bold = True
.Size = 12
End With
End If
Next iCtr
Next myCell
End Sub
Dave Peterson
|
Thanks a lot! That worked brilliantly. Much appreaciated.