![]() |
Automatically remove a Combo Box
I am trying to find out how to automatically remove a combo box after it is
created. This process needs to be repeatable. i.e. use one combo box response to generate a new combo box, then remove the new combo box after the message box that pops up from the second box actions have been acknowledged. Then be able to repeate the process. |
Automatically remove a Combo Box
An ActiveX combobox is both an OleObject and a Shape
Activesheet.OleObject("Combobox1").Delete Activesheet.Shapes("Combobox2").Delete A combobox from the forms toolbar is both a shape and an dropdown Activesheet.Shapes("Drop Down 1").Delete ActiveSheet.DropDowns("Drop Down 1").Delete A dropdown from data validation using the list option ActiveCell.Validation.Delete ActiveCell.offset(1,0).Select -- Regards, Tom Ogilvy "James" wrote in message ... I am trying to find out how to automatically remove a combo box after it is created. This process needs to be repeatable. i.e. use one combo box response to generate a new combo box, then remove the new combo box after the message box that pops up from the second box actions have been acknowledged. Then be able to repeate the process. |
Automatically remove a Combo Box
The Combo Box is from the forms Toolbar. Each time the first combo box
creates a new second Combo box, it is given an increasing number. So if I hardcode a number into the VBA code, it only works one time then the next time the second Combo box is created, it has a new number. James "Tom Ogilvy" wrote: An ActiveX combobox is both an OleObject and a Shape Activesheet.OleObject("Combobox1").Delete Activesheet.Shapes("Combobox2").Delete A combobox from the forms toolbar is both a shape and an dropdown Activesheet.Shapes("Drop Down 1").Delete ActiveSheet.DropDowns("Drop Down 1").Delete A dropdown from data validation using the list option ActiveCell.Validation.Delete ActiveCell.offset(1,0).Select -- Regards, Tom Ogilvy "James" wrote in message ... I am trying to find out how to automatically remove a combo box after it is created. This process needs to be repeatable. i.e. use one combo box response to generate a new combo box, then remove the new combo box after the message box that pops up from the second box actions have been acknowledged. Then be able to repeate the process. |
Automatically remove a Combo Box
I figured out how to name the combo box when it was being created so I could
use the same referance to delete it. Thank you Tom for the code to delete DropDown . James "Tom Ogilvy" wrote: An ActiveX combobox is both an OleObject and a Shape Activesheet.OleObject("Combobox1").Delete Activesheet.Shapes("Combobox2").Delete A combobox from the forms toolbar is both a shape and an dropdown Activesheet.Shapes("Drop Down 1").Delete ActiveSheet.DropDowns("Drop Down 1").Delete A dropdown from data validation using the list option ActiveCell.Validation.Delete ActiveCell.offset(1,0).Select -- Regards, Tom Ogilvy "James" wrote in message ... I am trying to find out how to automatically remove a combo box after it is created. This process needs to be repeatable. i.e. use one combo box response to generate a new combo box, then remove the new combo box after the message box that pops up from the second box actions have been acknowledged. Then be able to repeate the process. |
All times are GMT +1. The time now is 06:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com