Hello everyone-
I've been learning a lot from this forum about VBA, but while building my own project, I've run into a problem that I cannot figure out, despite hours of searching. But...I'm learning
Attempting to do:
Read down a column in excel and store the information in an array. Take this array and populate a combo box in a form. Simple, but I'm having difficulties.
Code:
Private Sub acctBox1_Change()
addTransaction
End Sub
Function addTransaction()
Dim curRow As Integer
Dim accountArr() As String
Dim x As Integer
Dim a As String
x = 1
curRow = 4
ReDim accountArr(1 To 100)
Do Until Sheets("Trial Balance").Cells(curRow, 2) = Empty
For x = x To curRow
curRow = curRow + 1
accountArr(x) = Sheets("Trial Balance").Cells(curRow, 2).Value
Next x
Loop
ReDim Preserve accountArr(1 To x)
transactionEntry.acctBox1.List = accountArr
End Function
I've been learning a lot from this forum about VBA, but while building my own project, I've run into a problem that I cannot figure out, despite hours of searching. But...I'm learning

Attempting to do:
Read down a column in excel and store the information in an array. Take this array and populate a combo box in a form. Simple, but I'm having difficulties.
Code:
Private Sub acctBox1_Change()
addTransaction
End Sub
Function addTransaction()
Dim curRow As Integer
Dim accountArr() As String
Dim x As Integer
Dim a As String
x = 1
curRow = 4
ReDim accountArr(1 To 100)
Do Until Sheets("Trial Balance").Cells(curRow, 2) = Empty
For x = x To curRow
curRow = curRow + 1
accountArr(x) = Sheets("Trial Balance").Cells(curRow, 2).Value
Next x
Loop
ReDim Preserve accountArr(1 To x)
transactionEntry.acctBox1.List = accountArr
End Function