Thursday, January 10, 2013

UDF To return the custom format applied on a cell

If you want to know custom format used in a cell. Try this UDF

Function custom_format(cl As Range) As String
    If cl.Cells.Count = 1 Then
        custom_format = "'" & cl.NumberFormat
    End If
End Function

Download Working File

Steps to Use
  • Copy the below code
  • Press Alt+F11 to open VBA editor
  • Paste it in any public module or module 1
  • For example If you want to extract the custom format used on cell A5 in Cell  B5. In cell B5 type =custom_format(A5)

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...