• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Is there a way to have 2 Private Sub Worksheet_Change events?

It seems you paste the code from a mail and not from post #24
as it was fixed a very few moment after its creation !
So open the post #21 attachment and paste to the sheet module
the code from actual post #24 …
 
It appears that you are correct. So sorry. I just tried it & it lets me enter H for holidays, but if I try to enter a number (.25 to 8), it is rejected. Attached is a updated sample of the actual work sheet. You will see that it is a work sheet to help track leave time. Sheet 1 tracks vacation time, sheet 2 tracks sick time. The holiday entries will be the same for both, but the numerical entries will be separate.

I won't make the same mistake twice.
 

Attachments

  • sample 3.xlsx
    18.7 KB · Views: 1
Last edited:
As a beginner starter :​
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count = 1 And Not Intersect([D4:Q29], Target) Is Nothing And Not Target.HasFormula Then
           S$ = UCase$(Left$(Target.Value2, 1))
        If S > "" Then
            Application.EnableEvents = False
            If S <> "H" Then Beep: Target.ClearContents Else Target.Value2 = S: Sheet2.Range(Target.Address).Value2 = S
            Application.EnableEvents = True
        End If
    End If
End Sub
Do you like it ? So thanks to click on bottom right Like !
It does copy the letter H, however it does not allow for numeric entries, that is the other piece of the puzzle. The entries can be any thing from .25 to 8. That is why I had to unlike the response.
 
Back
Top