We help IT Professionals succeed at work.

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

Richard Korts
on
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
Comment
Watch Question

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
can you post what you did so far and will do it ?
gowflow
Richard KortsBusiness Owner / Chief Developer

Author

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
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