krrishkrsna
Board Regular
- Joined
- Jan 31, 2009
- Messages
- 84
i am placing below code in ThisWorkbook (Excel VBA). whenever i go to new sheet the ComboBox1 should get created if it does not exist and should be deleted if already exists and create new combobox1, but getting below error
Run Time Error -2147024809(80070057) The item with the specified name was not found
If Not ActiveSheet.Shapes("ComboBox1").Name = "ComboBox1" Then
ActiveSheet.OLEObjects.Add(classtype:="Forms.ComboBox.1", link:=False, displayasicon:=False, Left:=100, Top:=50, _
Width:=120, Height:=28.5).Select
Else
ActiveSheet.Shapes("ComboBox1").Delete
End If
Please HELP
Run Time Error -2147024809(80070057) The item with the specified name was not found
If Not ActiveSheet.Shapes("ComboBox1").Name = "ComboBox1" Then
ActiveSheet.OLEObjects.Add(classtype:="Forms.ComboBox.1", link:=False, displayasicon:=False, Left:=100, Top:=50, _
Width:=120, Height:=28.5).Select
Else
ActiveSheet.Shapes("ComboBox1").Delete
End If
Please HELP