Sub Catnam(): Dim Typ As String, Cat As String, Sct As String, Pyr As String
Dim FDD As Date, Amt As Single, p As Long, q As Long, r As Long, er As Long
Dim wi As Worksheet, we As Worksheet, F, T, i As Integer, n As Integer
F = Array(" ", "weekly", "bi-weekly", "bi-monthly", "semi-monthly", _
"monthly", "quarterly", "semi-annually", "annually")
T = Array(0, 52, 26, 24, 12, 6, 4, 2, 1)
Set we = ActiveWorkbook.Sheets("Budget Entries")
we.Range("F:F").NumberFormat = "0.00"
Set wi = ActiveWorkbook.Sheets("Budget Input UI ") 'a space after UI here
er = 4: Do Until wi.Cells(er + 1, 1) = "": er = er + 1: Loop: q = 1
LoadIns:
For r = 4 To er
Typ = wi.Cells(r, 1): Cat = wi.Cells(r, 2): Sct = wi.Cells(r, 3)
Pyr = wi.Cells(r, 4): FDD = wi.Cells(r, 6): Amt = wi.Cells(r, 7)
For i = 1 To UBound(F)
If LCase(wi.Cells(r, 5)) = F(i) Then
n = Int(365 / T(i) + 0.5): Exit For: End If
Next i: p = T(i) - 1
For i = 0 To p: q = q + 1
we.Cells(q, 1) = Typ: we.Cells(q, 2) = Cat: we.Cells(q, 3) = Sct
we.Cells(q, 4) = FDD + i * n: we.Cells(q, 5) = Pyr: we.Cells(q, 6) = Amt
Next i
Next r
we.Cells.sort Key1:=Range("D1"), Order1:=xlAscending, Header:=xlYes
End Sub
Bookmarks