1.

Solve : Excel Upper to lower to Proper?

Answer»
This formula use to work in macros to go from lower to upper to proper. Now it does not.  Did I leave something out?  Did I not follow the procedure properly

Sub ToggleCase()
  Dim rng As Range
  Dim strVal As String
  If Selection Is Nothing Then
    Exit Sub
  End If
  For Each rng In Selection
    If Not rng.HasFormula Then
      strVal = rng.Value
      If strVal = UCase(strVal) Then
        rng.Value = LCase(strVal)
      ElseIf strVal = LCase(strVal) Then
        rng.Value = StrConv(strVal, vbProperCase)
      Else
        rng.Value = UCase(strVal)
      End If
    End If
  Next rng
  Set rng = Nothing
End Sub

1.   Go to the developer tab  ( To GET developer tab, Right click Office button, top left; click in excel OPTIONS at the bottom right, click on third box down, ‘Show developer tab in ribbon’.)
2.   Macro security on the left
3.   Click on ‘enable all macros’
4.   Click Record macros. Put in a NAME and a short cut key
5.   Click on Macros
6.   Click edit
7.   Remove what is there and paste code
8.   When you wan to use, highlight,  click on macros and hit run



Thank You Rodney Are you sure? Did you  copy it  verbatim?

Be very careful of elseif else and endif.


It would help if you would do better indentation so what you INTENTIONED be obvious.
It works for me in Excel 2007.

(Alt+F11, Insert->Module, Pasted, and then used from the "view" tab on the ribbon, VIA the Macros dropdown)


Discussion

No Comment Found