jonnyboy
08-26-2013, 01:49 PM
I am a new user to VBA coding and this is a whole brave-new world. I am creating a time sheet which has a great deal of time allocations based upon "validated" dept./type codes in columns B and C. What I am looking to accomplish, is to be sure that once the employee/user enters a description of worked performed in cell A, then I want the user to be forced to enter specific letter code (from validation lists) in both Column B, and Then also, in Col C. Here is what I have so far... I can only force entry into col B based on this VBA code.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myC As Range
For Each myC In Range("A8:A24")
If myC.Value <> "" And myC(1, 2).Value = "" And Intersect(Target, myC.Resize(1, 2)) Is Nothing Then
Application.EnableEvents = False
myC(1, 2).Select
MsgBox "Enter code please"
Application.EnableEvents = True
Exit Sub
End If
Next myC
End Sub
How do I modify my VBA code to compel user to subsequently enter a code to col C before proceeding to next line?
Your expertise will be extremely appreciated.
Jon
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myC As Range
For Each myC In Range("A8:A24")
If myC.Value <> "" And myC(1, 2).Value = "" And Intersect(Target, myC.Resize(1, 2)) Is Nothing Then
Application.EnableEvents = False
myC(1, 2).Select
MsgBox "Enter code please"
Application.EnableEvents = True
Exit Sub
End If
Next myC
End Sub
How do I modify my VBA code to compel user to subsequently enter a code to col C before proceeding to next line?
Your expertise will be extremely appreciated.
Jon