Combobox doesn't show items

ryancgarrett

Board Regular
Joined
Jun 18, 2011
Messages
122
I have a form with a combobox on it and use the following code to set the rowsource.

Code:
Sub populateComboBox()
   Dim lr As Long
    
    With Sheets("Data Sheet")
        lr = BlankRow("Data Sheet", 2, 4) - 1
        
        frmTransactionEntry.cbxAccount1.RowSource = .Range("D2:D" & lr).Address(False, False)
        frmTransactionEntry.cbxAccount2.RowSource = .Range("D2:D" & lr).Address(False, False)
        frmTransactionEntry.cbxAccount3.RowSource = .Range("D2:D" & lr).Address(False, False)
        frmTransactionEntry.cbxAccount4.RowSource = .Range("D2:D" & lr).Address(False, False)
        frmTransactionEntry.cbxAccount5.RowSource = .Range("D2:D" & lr).Address(False, False)
        frmTransactionEntry.cbxAccount6.RowSource = .Range("D2:D" & lr).Address(False, False)
        
    End With
End Sub

'Function to find the end of a list
Function BlankRow(sName As String, sRow As Integer, sCol As Integer) As Integer
    Do Until Sheets(sName).Cells(sRow, sCol).Value = Empty
        sRow = sRow + 1
    Loop
    
    BlankRow = sRow
End Function

When I first use it everything works great, but after I clear the form the combobox shows up with the appropriate amount of blank spaces, but no visible text. Here is the code I use to clear the form.

Code:
Sub ClearTransactionEntry()
    frmTransactionEntry.tbxDate.Value = Date
    frmTransactionEntry.tbxAmount1.Value = FormatCurrency(0, 2)
    frmTransactionEntry.tbxAmount2.Value = FormatCurrency(0, 2)
    frmTransactionEntry.tbxAmount3.Value = FormatCurrency(0, 2)
    frmTransactionEntry.tbxAmount4.Value = FormatCurrency(0, 2)
    frmTransactionEntry.tbxAmount5.Value = FormatCurrency(0, 2)
    frmTransactionEntry.tbxAmount6.Value = FormatCurrency(0, 2)
    
    frmTransactionEntry.cbxAccount1.Value = " "
    frmTransactionEntry.cbxAccount2.Value = " "
    frmTransactionEntry.cbxAccount3.Value = " "
    frmTransactionEntry.cbxAccount4.Value = " "
    frmTransactionEntry.cbxAccount5.Value = " "
    frmTransactionEntry.cbxAccount6.Value = " "
    
    frmTransactionEntry.tbxSumOfDebits.Value = " "
    frmTransactionEntry.tbxSumOfCredits.Value = " "
    frmTransactionEntry.tbxDescription.Value = " "
    
    frmTransactionEntry.optDebit1.Value = False
    frmTransactionEntry.optDebit2.Value = False
    frmTransactionEntry.optDebit3.Value = False
    frmTransactionEntry.optDebit4.Value = False
    frmTransactionEntry.optDebit5.Value = False
    frmTransactionEntry.optDebit6.Value = False

    frmTransactionEntry.optCredit1.Value = False
    frmTransactionEntry.optCredit2.Value = False
    frmTransactionEntry.optCredit3.Value = False
    frmTransactionEntry.optCredit4.Value = False
    frmTransactionEntry.optCredit5.Value = False
    frmTransactionEntry.optCredit6.Value = False
        
End Sub

Does anyone see anything wrong with what I am doing here? If it helps, here is a picture of my form:

 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
What actions are taken after you run populateComboBox? Is the userform displayed then? Is the userform still displayed ( without Unloading ) when you run ClearTransactionEntry?
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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