PDA

View Full Version : Solved: UDF in Conditional Formating



Mis_Sailesh
04-01-2010, 11:50 PM
Option Explicit

'This function was prepared by Sailesh Kr Mishra(91-9958050139)
'for showing how we can use UDF in Conditional formating
'and how we can use Regular Expressions in Excel

Function Color_Non_Standard(rngR As Range) As Boolean
Dim intI As Integer
For intI = 1 To Len(rngR.Value)
If Not Mid(rngR.Value, intI, 1) Like Cells(1, 1).Value Then
Color_Non_Standard = True
Exit Function
End If
Next intI
End Function
----------------------------------------------------------------------
Copy the above code.
Open any workbook.
Press Alt + F11 to open the Visual Basic Editor (VBE).
From the Menu, choose Insert-Module.
Paste the code into the right-hand code window.
Close the VBE, save the file if desired
----------------------------------------------------------------------
'Feel free to contact for any Excel & VBA based help

:help