HEALTHSTAFF
New Member
- Joined
- Oct 5, 2017
- Messages
- 12
Hello,
When using a date picker or textbox in a user form can i use data validation to message users to select a new date if a Saturday, Sunday or a list of dates on the worksheet. I can do this on a cell using the following formula
data validation Formula
Can this be done on a user form when OK button pressed and before any data pasted to worksheet. The OK button code is as follows
Any Help Greatly appreciated
Craig
When using a date picker or textbox in a user form can i use data validation to message users to select a new date if a Saturday, Sunday or a list of dates on the worksheet. I can do this on a cell using the following formula
data validation Formula
Code:
=(WEEKDAY(A2,2)<6)*ISNA(MATCH(A2,K1:K9,0))
Can this be done on a user form when OK button pressed and before any data pasted to worksheet. The OK button code is as follows
Code:
Private Sub OK_Click()Dim LastRow As Long, ws As Worksheet
Set ws = Sheets("Sheet1")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1
ws.Range("B" & LastRow).Value = TextBox1.Value
ws.Range("C" & LastRow).Value = TextBox3.Value
ws.Range("D" & LastRow).Value = TextBox2.Value
ws.Range("E" & LastRow).Value = TextBox5.Value
ws.Range("A" & LastRow).Value = Calendar1.Value
End Sub
Craig