Saturday, July 3, 2010

VBA Code for propercase

If you want to clean and trim selected cells in one go . Try this macro



Sub Proper_case()

Dim cell_1 As Range

For Each cell_1 In Selection.Cells
    If cell_1.HasFormula = False And Not IsEmpty(cell_1) And Not IsDate(cell_1) Then
        cell_1 = StrConv(cell_1.Text, vbProperCase)
    End If
Next


End Sub




Steps to Use
  • Copy the below code
  • Press Alt+F11 to open VBA editor
  • Paste it in any public module or module 1
  • Select the cells & run the Macro

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...