vba compile error

ww4612

Well-known Member
Joined
Apr 24, 2014
Messages
515
Hello
I have confronted an vba compile error, while making an userform. my code is the following
Code:
Private Sub CommandButton1_Click()
name.Value = ""
you.Value = ""
destination.Value = ""
region.Value = ""
country.Value = ""
month.Value = ""
year.Value = ""
qa.Value = False
qn.Value = False
purpose.Value = "Remarks (optional)"
applicants.Value = ""
position.Value = ""
email.Value = ""
phone.Value = ""
fax.Value = ""
address.Value = ""
population.Value = ""
surface.Value = ""
shore.Value = ""
popuR.Value = ""
surfR.Value = ""
shoR.Value = ""
A.Value = ""
B.Value = ""
C.Value = ""
D.Value = ""
End
End Sub
qa, qn are optionbutton
month, year are combobox
the rest are all textbox
please help me.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Care to tell us what line of code?
 
Upvote 0
name
month
year
address

...are all commands or properties used in VBA. Change those Control names.

Also delete the End command (2nd to last line in your code).

Best practice is to add a prefix to the control name that designates what type of control it its e.g.; tbName would be a textbox control.
 
Last edited:
Upvote 0
name
month
year
address

...are all commands or properties used in VBA. Change those Control names.

Also delete the End command (2nd to last line in your code).

Best practice is to add a prefix to the control name that designates what type of control it its e.g.; tbName would be a textbox control.

that actually worked. thank you. by the way, could you tell me what is the prefix control name for the other items, like option button, combobox
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,281
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top