Forum Discussion

Re: Macro in Excel

JoergSchmitt 

Hi Jörg,

try this:

 

Sub ConvertToUpper()
Dim rngCell As Range

For Each rngCell In Selection
rngCell.Value = UCase(rngcell.value)
Next rngCell
End Sub


Sub ConvertToLower()
Dim rngCell As Range

For Each rngCell In Selection
rngCell.Value = LCase(rngcell.value)
Next rngCell
End Sub

 

Best regards

Bernd

https://vba-tanker.com/

 

2 Replies

  • JoergSchmitt's avatar
    JoergSchmitt
    Copper Contributor

    Bernd good morning,

    Thanks for the quick reply. I will let you know whether I killed my computer...

    Joerg

    • Rusty Dane's avatar
      Rusty Dane
      Brass Contributor

      JoergSchmitt 

       

      It sounds like  you want to change to proper case.  Try this.  It also checks for any cells that have formulas (can cause problems).  Select your cells & run the macro.

       

      Sub ProperCase()
      Dim Rng As Range
      For Each Rng In Selection.Cells
      If Rng.HasFormula = False Then
      Rng.Value = Application.Proper(Rng.Value)
      End If
      Next Rng
      End Sub