Dim I As Integer
Dim tCol As Integer
Dim ExRange As Range
Dim Ans
Dim ToRow As Integer
Dim temp_row As Integer
Ans = MsgBox("Did your employer reimburse you for this expense?", vbQuestion + vbYesNo, "PerDiem Traveler")
If Ans = vbNo Then
On Error Resume Next
If Me.cboDesc.Text = vbNullString Or Me.Amnt.Text = vbNullString Then
MsgBox "All entries must be completed before your expense can be registered.", vbExclamation, "PerDiem Traveler"
Exit Sub
End If
On Error Resume Next
If Me.cboDesc.Text = vbNullString Or Me.Amnt.Text = vbNullString Then
MsgBox "All entries must be completed before your expense can be registered.", vbExclamation, "PerDiem Traveler"
Exit Sub
End If
If cboCat = "All Categories" Then
MsgBox "Select an expense category", vbExclamation, "PerDiem Traveler"
Else
If LenB(Table) = 0 Or Table < 1000 Then
With Application.WorksheetFunction
Table = .CountA(Range("Expense").Columns(1)) + 1
End With
End If
AddNew
With Me.ListBox3
If .ListIndex > -1 Then
ToRow = Sheets("Calculator").Range("BB11").Offset(.ListIndex, 0).Value
On Error GoTo 0
If LenB(.Value) > 0 And Ent5.Caption = "Update" Then 'updating a item....
temp_row = .ListIndex
Range("Expense").Cells(ToRow, 2) = CDate(Me.Date5)
Range("Expense").Cells(ToRow, 3) = cboCat.Value
Range("Expense").Cells(ToRow, 4) = cboDesc.Value
Range("Expense").Cells(ToRow, 5) = CCur(Replace(Me.Amnt, "$", ""))
Range("Expense").Cells(ToRow, 6) = "$0.00"
Load_Itemized
Exit Sub
End If
Else
Range("Expense").Cells(Table, 1) = Application.Max(Range("AU11:AU500")) + 1
Range("Expense").Cells(Table, 2) = CDate(Date5)
Range("Expense").Cells(Table, 3) = cboCat.Value
Range("Expense").Cells(Table, 4) = cboDesc.Value
Range("Expense").Cells(Table, 5) = CCur(Replace(Amnt, "$", ""))
Range("Expense").Cells(Table, 6) = "$0.00"
End If
End With
Range("AV11:AZ500").Sort key1:=Range("AV11"), order1:=xlAscending, Header:=xlNo
LoadList
NewExpense
End If
For tCol = 42 To 46
Set ExRange = ActiveSheet.Range(Cells(10, tCol), Cells(30, tCol))
ExRange.Sort key1:=ExRange.Cells(1, 1), order1:=xlAscending, Header:=xlYes
Next tCol
Else
frmComp.Show
End If