ryancgarrett
Board Regular
- Joined
- Jun 18, 2011
- Messages
- 122
It's 2 in the morning and I'm falling asleep as I code my project lol. I can't figure out for the life of me what I have done wrong here. Can anyone help?
The form has 6 lines on it for transactions, but if there aren't 6 lines it shouldn't still include them when putting in the description. Not sure if that made sense, but basically there are two transactions on rows 4 and 5, and then 4 blank rows and then my description. How do I get it to overlook those blank lines on the form?
Code:
Sub tranAcct()
Dim eRow As Integer
Dim nextBox As Integer
eRow = BlankRow("Journal", 3, 2) + 1
With frmTransactionEntry
For nextBox = 1 To 6
If .Controls("cbxAccount" & nextBox).Value <> 0 Then
Sheets("Journal").Cells(eRow, 2).Value = .Controls("cbxAccount" & nextBox).Value
If .Controls("optCredit" & nextBox).Value = True Then
Sheets("Journal").Cells(eRow, 2).InsertIndent 1
Sheets("Journal").Cells(eRow, 7).Value = .Controls("tbxAmount" & nextBox)
ElseIf .Controls("optDebit" & nextBox).Value = True Then
Sheets("Journal").Cells(eRow, 5).Value = .Controls("tbxAmount" & nextBox)
End If
eRow = eRow + 1
End If
Next
End With
Sheets("Journal").Cells(eRow, 2).Value = frmTransactionEntry.tbxDescription
Sheets("Journal").Cells(eRow, 2).InsertIndent 2
Sheets("Journal").Cells(eRow, 2).Font.Italic = True
End Sub
The form has 6 lines on it for transactions, but if there aren't 6 lines it shouldn't still include them when putting in the description. Not sure if that made sense, but basically there are two transactions on rows 4 and 5, and then 4 blank rows and then my description. How do I get it to overlook those blank lines on the form?