I have a sheet that is used for sales entry, that has 15 different columns that get formatted based on what is entered in the cell. It's simple formatting, converting to proper case, things like that.
The shortened version of the code is:
Private Sub Worksheet_Change(ByVal target As Range)
On Error GoTo Cleanup
Application.EnableEvents = False: Application.ScreenUpdating = False:
Application.Calculation = xlCalculationManual ' etc..
Dim rName As String
If Not (Application.Intersect(target, Range("C2:C" & Me.Cells(Me.Rows.Count,"C").End(xlDown).Row)) Is Nothing) Then
rName = target.Value2
target.Value2 = UCase(Trim(rName))
End If
14x more above the above (1 each column)
Cleanup:
Application.EnableEvents = True: Application.ScreenUpdating = True:
Application.Calculation = xlCalculationAutomatic ' etc..
The reason I have it set to manual, then automatic, is because if I don't, Excel crawls to a halt. I'm assuming because when a user enters data, it changes values for hidden columns, and triggers the Change event again. The way it works now, is fine, however there is just a second or two delay after each cell is checked and formatted after a user enters the data, so ultimately I'm wondering if there is a quicker way to do it.
Thanks!