N
naeem.mahmood
Hi,
I have created a user form to update the balanaces in the accounts.
User can pick the dates, which are user can choose by a combox box and
update accordingly.
I want to have a validation check for the date so that the user are
not allowed to pick dates which have balances already attached to
them.
I tried creating the following but its not working. I am new to VBA so
if someone can help me move in the right direction that would be
really helpful.
---------------------------------------------------
Private Sub cmblist_Change()
DateCheck
End Sub
----------------------------------------------------
Private Sub DateCheck()
If cmblist.Value < Sheets("CDN").Range("DateDBCDN") Then
' DateDBCDN is the range where the dates are posted from the user
form.
msg = "Data for this date is already posted"
Sheets("Main").Select
Range("A2").Select
dialogstyle = vbOKOnly + vbCritical
Title = "Invalid Date"
Response = MsgBox(msg, dialogstyle, Title)
End If
End Sub
-----------------------------------------------------------------------
I have created a user form to update the balanaces in the accounts.
User can pick the dates, which are user can choose by a combox box and
update accordingly.
I want to have a validation check for the date so that the user are
not allowed to pick dates which have balances already attached to
them.
I tried creating the following but its not working. I am new to VBA so
if someone can help me move in the right direction that would be
really helpful.
---------------------------------------------------
Private Sub cmblist_Change()
DateCheck
End Sub
----------------------------------------------------
Private Sub DateCheck()
If cmblist.Value < Sheets("CDN").Range("DateDBCDN") Then
' DateDBCDN is the range where the dates are posted from the user
form.
msg = "Data for this date is already posted"
Sheets("Main").Select
Range("A2").Select
dialogstyle = vbOKOnly + vbCritical
Title = "Invalid Date"
Response = MsgBox(msg, dialogstyle, Title)
End If
End Sub
-----------------------------------------------------------------------