ryancgarrett
Board Regular
- Joined
- Jun 18, 2011
- Messages
- 122
Everytime I run this code I get a "Run-time error '13': Type Mismatch" and I can't figure out why. Can anyone tell me what the error means and how to fix it? Thanks!
Code:
Sub populateComboBox()
Dim lr As Long
With Sheets("Data Sheet")
lr = BlankRow("Data Sheet", 2, 4)
frmTransactionEntry.cbxAccount1.RowSource = .Range("D2:D" & lr) 'This is where I get the error
frmTransactionEntry.cbxAccount2.RowSource = .Range("D2:D" & lr)
frmTransactionEntry.cbxAccount3.RowSource = .Range("D2:D" & lr)
frmTransactionEntry.cbxAccount4.RowSource = .Range("D2:D" & lr)
frmTransactionEntry.cbxAccount5.RowSource = .Range("D2:D" & lr)
frmTransactionEntry.cbxAccount6.RowSource = .Range("D2:D" & lr)
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