Hi All,
Another day..... another issue.
I have a worksheet that I need to run multiple Worksheet_changes with.
The first part of the code to change range to uppercase works but the second portion of the code, meant to automatically change a cell from text to time format HH:MM does not..... keeps returning 0:00. for example if I enter 1330 it should change to 13:30.
Any thoughts??
Bedsy
Another day..... another issue.
I have a worksheet that I need to run multiple Worksheet_changes with.
The first part of the code to change range to uppercase works but the second portion of the code, meant to automatically change a cell from text to time format HH:MM does not..... keeps returning 0:00. for example if I enter 1330 it should change to 13:30.
Any thoughts??
Bedsy
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
On Error GoTo ErrHandler
Application.ScreenUpdating = False
Application.EnableEvents = False
If Not Intersect(Target, Range("A4:K27")) Is Nothing Then
For Each rng In Intersect(Range("A4:K27"), Target)
Target.Value = UCase(Target.Value)
Next rng
End If
Set rng = Target.Parent.Range("H:H, I:I, K:K, L:L")
If Target.CountLarge > 1 Then Exit Sub
If Target.Row < 2 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then
With Application
.EnableEvents = False
.ScreenUpdating = False
.Undo
End With
Target.Value = x / 1440
Target.NumberFormat = "[h]:mm"
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
ExitHandler:
Application.EnableEvents = True
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End Sub