Yes, in that instance the Selected cell and the Target cell are not the same, because hitting enter moves the selected cell down one.
This modification should accommodate that.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myValue As String
Dim myRange As Range
Application.EnableEvents = False
' Capture value entered in first cell
myValue = Target.Cells(1, 1).Value
' Capture entire selected range
If Selection.Count > 1 Then
Set myRange = Selection
Else
Set myRange = Target
End If
' Set entire range equal to value from first cell
myRange = myValue
' Apply appropriate formatting
Select Case myValue
Case "h"
myRange.Interior.Color = vbGreen
Case "s"
myRange.Interior.Color = vbRed
Case "v"
myRange.Interior.Color = vbBlue
End Select
Application.EnableEvents = True
End Sub
Well, if you have other Event Procedures, that is one reason. But the main reason is so that the event procedure calls itself and get caught in an endless loop.
Think about it. This event procedure runs whenever a cell is updated. What do you think happens if the code itself updates cells?