Display Message "Empty" when Combbox1 has no values or rather Empty

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
688
Anyone

in user Forfm
Code:
Private Sub UserForm_Initialize()
  combobox1.dropstyle =  1-FrmDropButtonStyleArrow
  'when UserForm is Intialized or activated  the 
  combobox1.value = ""   'or  
  combobox1.text = ""
End Sub


1. When clicked on above combobox1 or on the arrowbutton of the combobox1 i want a msg that combobox is Empty and the list is also empty and gives the option to select from another combobox2 ----- How to achieve this ?

I tried the below in Combobox1_Change event nothing worked also in Combobox1_Click Event it did not work

Code:
'If cmbProdCode Is Nothing Then
'If cmbProdCode.ListIndex = -1 Then
'If cmbProdCode = vbNullString Then
'If cmbProdCode.Value = "" Then
'   MsgBox "Empty" , vbOKOnly
'End If


Thanks in Advance


NimishK
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,
try using the controls listcount property and see if this does what you want

Code:
  If Me.ComboBox1.ListCount = 0 Then
        'do something
        
    Else
    
        'do something else
        
    End If

Dave
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top