I have the code below that I would like to use to set the proper casing for a range that can be 20 records or can be 500 records as the data changes daily. The problem is that takes long because it is evaluating blank records. I want it to just set the proper casing to the records and stop at the blank rows. I know I have to use either XlDown or XLup but cannot seem to get the syntax right. The range starts at V2 and ends at the first blank row.
Sub propercase_test()
Dim LCRange As Long
LCRange =
Sheets("Profitability").Cells(Sheets("Profitability").Rows.Count,
"V").End(xlUp).Row
For Each Rng In Range(LCRange)
Rng.Value = Application.WorksheetFunction.Proper(Rng.Value)
Next Rng
End Sub
Edited code:
Sub propercase_test()
Dim LCRange As Range
With Sheets("Profitability")
LCLastRow = .Range("V" & .Rows.Count).End(xlUp).Row
Set LCRange = Range("V" & LCLastRow)
End With
For Each Rng In Range(LCRange)
Rng.Value = Application.WorksheetFunction.Proper(Rng.Value)
Next Rng
End Sub