Excel - Put command button on sheet & connect to a VB sub

How do I do the title?

I created a vb sub to use the Clean function, I cannot figure out how to run it.

Thanks
Richard KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gowflowCommented:
Just call the sub from the macro menu.

Either from the developer Menu press on the Macro button and choose your macro and press Run
or
From the View Menu the last item is Macro press on the drop down and Choose Macroes and select your macro from the ones showing and press run

gowflow
gowflowCommented:
can you post what you did so far and will do it ?
gowflow
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
I figured it out. I was using a normal command button, not an Active X control.

For some unknown reason, you create an Active x command button control & it names it Commandbutton21

There is no Macro; just the attached.

I never could figure out macros in Excel.
Clean-VB-sub.jpg
gowflowCommented:
Well what do you want to achieve ?? to clear data ?? no need for all this code simply this

Sub Clean()
ActiveSheet.Cells.ClearContents
End Sub

Open in new window


gowflow

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.