Want to become an expert in VBA? So this is the right place for you. This blog mainly focus on teaching how to apply Visual Basic for Microsoft Excel. So improve the functionality of your excel workbooks with the aid of this blog. Also ask any questions you have regarding MS Excel and applying VBA. We are happy to assist you.

Clear the value of a text box when click on it

Some times we need to clear the text box when click on top of it.

Ex - Enter date to a text box which displays "Date" on it.

So you have to put the code to MouseUp event of the text box. Below is the code for a date text box

Private Sub txtBDate_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

If txtBDate.Text = "Date" Then
    txtBDate.Text = ""
End If

End Sub

Contact Form

Name

Email *

Message *

Popular Posts