Clear Comboboxes & Textboxes

M

MBlake

Hi,
I have a userform containing various VBA controls such as comboboxes,
listboxes and check boxes. I want to provide the option for a user to clear
the form. I have tried the below code but get an error message stating
'Compile error - Sub or Function not defined'

Please can anyone tell me where I am going wrong with this?

Command Button Code -

Private Sub cmdbuttonClear_Click()
Call frmDataEntry_Initialize
End Sub

Thanks for any help,
Mickey
 
A

Alan

Try using the Command Button with the code like

Private Sub CommandButton1_Click()
ComboBox1 = ""
TextBox1 = ""
End Sub

etc
Regards,
 
C

Chip Pearson

You probably want

Call Userform_Initialize

rather than

Call frmDataEntry_Initialize


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
M

MBlake

Cheers Guys,
Some days I feel likeI am getting there and then other days I feel miles
away. It is all good fun though :)

Mickey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top