Excel VBA Worksheet_Change Question

Excel 2010 VBA
I am working with the Sub Worksheet_Change routine that takes an entry such as 824 and simply formats that entry to 8:24 (for time). My problem is that my routine actually runs twice. Once to set up the change and then again after the change is implemented. When certain times (such as 824) are entered an unexpected result (0.:35) is created the second run through the procedure. I modified the code to correct for this by changing the range value, but if I select and delete the values in more than one cell, Excel crashes. The original code does not crash if I delete multiple cells values. Any suggestions on how to get the best of both worlds?
Original Code:
Private Sub Worksheet_Change(ByVal target As Range)
    If target.Row = 65 _
    Or target.Row = 66 Then
       timeval = target.Value
       If InStr(1, timeval, ":") = 0 Then
        Select Case Len(timeval)
            Case 3
                valHour = Left(timeval, 1)
                valMinute = Right(timeval, 2)
                target.Value = valHour & ":" & valMinute
            Case 4
                valHour = Left(timeval, 2)
                valMinute = Right(timeval, 2)
                target.Value = valHour & ":" & valMinute
        End Select
       End If
    End If
End Sub

Modified Code:
Private Sub Worksheet_Change(ByVal target As Range)
    If target.Row = 65 _
    Or target.Row = 66 Then
       timeval = target.Value
      Rng = target.Address
     strWkst = Me.Name
       If InStr(1, timeval, ":") = 0 Then
        Select Case Len(timeval)
            Case 3
                valHour = Left(timeval, 1)
                valMinute = Right(timeval, 2)
                Worksheets(strWkst).Range(Rng).Value = valHour & ":" & valMinute
            Case 4824
                valHour = Left(timeval, 2)
                valMinute = Right(timeval, 2)
                Worksheets(strWkst).Range(Rng).Value = valHour & ":" & valMinute
        End Select
       End If
    End If
End Sub

LVL 2
GISCOOBYDirector of Information TechnologyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kgerbChief EngineerCommented:
Just add

Application.EnableEvents = False

at the beginning of your code and then

Application.EnableEvents = True

at the end of your code to turn it back on.  This will disable excels events so your code will not fire a change event when modifying the sheet.

Kyle

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GISCOOBYDirector of Information TechnologyAuthor Commented:
Rock on! Thank you! That was exactly what I was looking for.
kgerbChief EngineerCommented:
You're welcome:).  Glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.