Link to home
Start Free TrialLog in
Avatar of jspc
jspcFlag for Australia

asked on

ProperCase in Excel (Sheet)

Hello,

Does anyone know how to run PROPER (Propercase) on an entire Worksheet in Excel (Does ALL columns)?

Thanks.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

test this, place the codes in a module in excel

 
Sub MakeProper()
    Dim rng As Range
    Dim lMax As Long, lCtr As Long, iRow As Integer, iCol As Integer
    Sheets(1).Select

    iRow = ActiveSheet.UsedRange.Rows.Count
    iCol = ActiveSheet.UsedRange.Columns.Count
    Set rng = ActiveSheet.Range("A1:" & Chr(64 + iCol) & iRow)
    lMax = rng.Cells.Count

    For lCtr = 1 To lMax
            rng.Cells(lCtr) = Application.Proper(rng.Cells(lCtr))
    Next lCtr
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2016