如何在Excel删除所有按钮或命令按钮?

网友投稿 918 2024-01-12

如何在Excel中删除所有按钮或命令按钮?

本文讨论的是从Excel的活动工作表中删除所有窗体控制按钮或命令按钮。

选中所有按钮,包括窗体控制按钮和命令按钮,将其全部删除

如何在Excel中删除所有按钮或命令按钮?

通过VBA代码删除所有按钮,包括窗体控制按钮和命令按钮

使用VBA代码删除所有表单控制按钮或命令按钮
选中所有按钮,包括窗体控制按钮和命令按钮,将其全部删除
惊人的! 在 Excel 中使用高效的选项卡,如 Chrome、Firefox 和 Safari! 每天节省50%的时间,并减少数千次鼠标单击!

请执行以下操作以从活动工作表中删除所有按钮(包括表单控制按钮和命令按钮)。

1.通过单击启用设计模式 开发商 > 设计模式。 看截图:

2.选择一个命令按钮,然后按 按Ctrl + A 键以选择当前工作表中的所有按钮。

3。 按 删除 键删除所有选中的按钮。

备注:如果此工作表中还有其他对象,则也会选择它们。

通过VBA代码删除所有按钮,包括窗体控制按钮和命令按钮

此外,您可以在VBA脚本下方应用以从Excel当前工作表中删除所有按钮。

1.打开包含您要删除的按钮的工作表,然后按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块,然后将以下VBA代码复制到“代码”窗口中。

VBA代码:从活动工作表中删除所有按钮

Sub Clear_ButtonsActiveSheet() Dim I As Long Dim xOLE As Object On Error Resume Next ActiveSheet.Buttons.Delete For Each xOLE In ActiveSheet.OLEObjects If TypeName(xOLE.Object) = "CommandButton" Then xOLE.Delete End If Next End Sub
Copy
3. Press the F5 key to run the code. Then all buttons including form control buttons and command buttons are removed from current worksheet immediately. Remove all form control buttons or command buttons with VBA code If you only want to remove all form control buttons or all command buttons from active sheet. You can try the below VBA codes to achieve it. 1. Open the worksheet contains the buttons you want to remove, and then press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window. 2. In the Microsoft Visual Basic for Applications window, click Insert > Module, then copy below VBA code into the Code window. VBA code: Remove all form control buttons from active sheet Sub Clear_ButtonsActiveSheet() ActiveSheet.Buttons.Delete End Sub VBA code: Remove all command buttons from active sheet Sub Clear_ButtonsActiveSheet() Dim xOLE As Object On Error Resume Next For Each xOLE In ActiveSheet.OLEObjects If TypeName(xOLE.Object) = "CommandButton" Then xOLE.Delete End If Next End Sub 3. Press the F5 key to run the code. Then all form control buttons or all command buttons are removed from current worksheet immediately. Related articles: How to insert a blank new row automatically by Command Button in Excel? How to use Command Button to save active worksheet as PDF file in Excel? How to update or insert (current) date and time by a Command Button in Excel? How to use a Command Button to change a specified cell value in Excel? Best Office Productivity Tools Transform Hours into Minutes with Kutools for Excel! Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed! Why You Need Kutools for Excel 🛠️ Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios. 📈 Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat! ⏱️ Efficient Batch Operations: Why put in extra effort when you can work smart? Import, export, combine, and tweak data in bulk with ease. 📊 Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story. 🗄️ Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites. 📝 Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types. 🎓 User-Friendly: A breeze for beginners and a powerful tool for experts. Download Now and Soar Through Time with Excel! Read More... Free Download... Purchase... Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project. Open and create multiple documents in new tabs of the same window, rather than in new windows. Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! Read More... Free Download... Purchase...

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:如何从Excel单元格中删除除前x个字符外的所有字符?
下一篇:如何从Excel单元格中删除第一个/最后一个空格之后的所有字符?
相关文章