Bad Code

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

What's wrong with this? After entering data, the focus is still in the same cell. I want to
advance to the next cell without pressing the <Enter> key again.

Option Explicit
Public Kount
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim NewVal, ValTyped
If Kount = 0 Then
If Target.Address = "$E$12" Then
Range("E12").Select
ValTyped = ActiveCell.FormulaR1C1
NewVal = Left(ValTyped, 2) & "/" & Mid(ValTyped, 3, 2) & "/" & Right(ValTyped, 2)
Kount = 1
ActiveCell = NewVal
End If
End If
Kount = 0
End Sub


Thanks,
Bernie
 
Why do you think a new cell would be selected automatically?

ActiveCell.Offset(1).Activate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top