ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combo box close on selection help!! (https://www.excelbanter.com/excel-programming/299465-combo-box-close-selection-help.html)

Simon Lloyd[_467_]

combo box close on selection help!!
 
Hi All,

I have created a user form and populated it from a list my Workshee
sheetselection change code calls on the userform to pop up the dialo
box and the selection is made from a drop down list my only problem i
this at the moment, when selection is made from the dropdown list
want the userform/dialog box to close.....i do not want to add a cance
or ok button making the use of the box a 2 click operation.

Here's my code so far!

Simon

Private Sub UserForm_Click()
On Error Resume Next
ActiveCell.Select
ActiveCell.Value = ComboBox1.Value
If ActiveCell.Value = True Then

Unload Me
End If
End Su

--
Message posted from http://www.ExcelForum.com


Bob Flanagan

combo box close on selection help!!
 
use

Me.Close

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Simon Lloyd " wrote in message
...
Hi All,

I have created a user form and populated it from a list my Worksheet
sheetselection change code calls on the userform to pop up the dialog
box and the selection is made from a drop down list my only problem is
this at the moment, when selection is made from the dropdown list i
want the userform/dialog box to close.....i do not want to add a cancel
or ok button making the use of the box a 2 click operation.

Here's my code so far!

Simon

Private Sub UserForm_Click()
On Error Resume Next
ActiveCell.Select
ActiveCell.Value = ComboBox1.Value
If ActiveCell.Value = True Then

Unload Me
End If
End Sub


---
Message posted from http://www.ExcelForum.com/




Simon Lloyd[_468_]

combo box close on selection help!!
 
I have tried Me.Close and the line isnt recognised in the code an
causes a debug!!

Simo

--
Message posted from http://www.ExcelForum.com


Chip Pearson

combo box close on selection help!!
 
Simon,

The Userform object doesn't have a Close method. You probably
want the Hide method. E.g.,

Me.Hide


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Simon Lloyd " wrote
in message ...
I have tried Me.Close and the line isnt recognised in the code

and
causes a debug!!

Simon


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com