Best Online Learning Platform and Collect Information

Case converter or Macro for change case

Case converter or Macro for change case

Hi all Here in my office I have to change case of multiple ranges on daily bases, it`s very time consuming. So to solve this I create a macro , it`s very fast. You can also try this,

Just paste this code in your module and save.

Case converter or Macro for change case

Always save this file as Macro Enabled Excel Workbook
                                                                                                                                                    

'case converter By Vikash
Sub CaseConverterByVikash()
'case converter By Vikash
Dim ocell As Range, ans As String

ans = Application.InputBox("Type in Letter" & vbCr & _
    "(L)owercase, (U)ppercase, (S)entence, (T)itles ")

If ans = "" Then Exit Sub

For Each ocell In Selection.SpecialCells(xlCellTypeConstants, 2)
    Select Case UCase(ans)
        Case "L": ocell = LCase(ocell.Text)
        Case "U": ocell = UCase(ocell.Text)
        Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
            LCase(Right(ocell.Text, Len(ocell.Text) - 1))
        Case "T": ocell = Application.WorksheetFunction.Proper(ocell.Text)
    End Select
Next

End Sub

.                                                                                                                                                           

Always open this file to perform this Macro

You can Also Download Exercise file from here Case converter or Macro for change case

Thanks in advance.
Share:

Popular Posts