Sub Main_Year_Up() Dim CurrentYear As String Dim YearBegnning

Sub Main_Year_Up()
Dim CurrentYear As String
Dim YearBegnning As Integer
Dim YearEnding As Integer
Application.ScreenUpdating = False
CurrentYear = ActiveSheet.Range("F5")
YearBeginning = Int(Left(CurrentYear, 4))
YearBeginning = YearBeginning + 1
YearEnding = Int(Right(CurrentYear, 4))
YearEnding = YearEnding + 1
Range("F5").Value = CStr(YearBeginning) + "_" + CStr(YearEnding)
Application.ScreenUpdating = True
End Sub
Sub Main_Year_Down()
Dim CurrentYear As String
Dim YearBegnning As Integer
Dim YearEnding As Integer
Application.ScreenUpdating = False
CurrentYear = ActiveSheet.Range("F5")
YearBeginning = Int(Left(CurrentYear, 4))
YearBeginning = YearBeginning - 1
YearEnding = Int(Right(CurrentYear, 4))
YearEnding = YearEnding - 1
Range("F5").Value = CStr(YearBeginning) + "_" + CStr(YearEnding)
Application.ScreenUpdating = True
End Sub
Sub YO_Year_Down()
Dim CurrentYear As String
Dim YearBegnning As Integer
Dim YearEnding As Integer
Application.ScreenUpdating = False
CurrentYear = ActiveSheet.Range("H5")
YearBeginning = Int(Left(CurrentYear, 4))
YearBeginning = YearBeginning - 1
YearEnding = Int(Right(CurrentYear, 4))
YearEnding = YearEnding - 1
Range("H5").Value = CStr(YearBeginning) + "_" + CStr(YearEnding)
Application.ScreenUpdating = True
End Sub
Sub YO_Year_Up()
Dim CurrentYear As String
Dim YearBegnning As Integer
Dim YearEnding As Integer
Application.ScreenUpdating = False
CurrentYear = ActiveSheet.Range("H5")
YearBeginning = Int(Left(CurrentYear, 4))
YearBeginning = YearBeginning + 1
YearEnding = Int(Right(CurrentYear, 4))
YearEnding = YearEnding + 1
Range("H5").Value = CStr(YearBeginning) + "_" + CStr(YearEnding)
Application.ScreenUpdating = True
End Sub
Sub Main_Nav_Month()
Dim FinancialYear As String
Dim CurrentMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("F5")
CurrentMonth = ActiveSheet.Shapes(Application.Caller).Name
DestinationSheet = ActiveSheet.Range("A1")
If Not SheetExists(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet)
Then
Sheets(DestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(DestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = CurrentMonth
If DestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If DestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value = "Expenses"
Else
Sheets(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet).Select
End If
Range("C23").Select
Application.ScreenUpdating = True
End Sub
Function SheetExists(SheetName As String) As Boolean
SheetExists = False
On Error GoTo NoSuchSheet
If Len(Sheets(SheetName).Name) > 0 Then
SheetExists = True
Exit Function
End If
NoSuchSheet:
End Function
Sub DeleteSheet()
Application.ScreenUpdating = False
ActiveWindow.SelectedSheets.Delete
Sheets("Main").Select
Application.ScreenUpdating = True
End Sub
Sub Main_Inc()
UnLockSheet
Application.ScreenUpdating = False
ActiveSheet.Shapes("bt_Inc").Fill.ForeColor.RGB = RGB(200, 255, 200)
ActiveSheet.Shapes("bt_Exp").Fill.ForeColor.RGB = RGB(63, 128, 205)
Range("A1").Value = "Inc"
Application.ScreenUpdating = True
LockSheet
End Sub
Sub Main_Exp()
UnLockSheet
Application.ScreenUpdating = False
ActiveSheet.Shapes("bt_Inc").Fill.ForeColor.RGB = RGB(63, 128, 205)
ActiveSheet.Shapes("bt_Exp").Fill.ForeColor.RGB = RGB(200, 255, 200)
Range("A1").Value = "Exp"
Application.ScreenUpdating = True
LockSheet
End Sub
Sub Main_Nav_Details()
Sheets("Details").Select
Range("C10").Select
End Sub
Sub Nav_Main()
Sheets("Main").Select
Range("F1").Select
End Sub
Sub Nav_Yearly()
Sheets("YearlyOverview").Select
End Sub
Sub Nav_Tax()
Sheets("Tax").Select
End Sub
Sub Details_SameAsRes()
Dim Address1 As String
Dim Address2 As String
Dim Address3 As String
Dim Address4 As String
Dim Address5 As String
Application.ScreenUpdating = False
Address1 = Range("C17").Value
Address2 = Range("C18").Value
Address3 = Range("C19").Value
Address4 = Range("C20").Value
Address5 = Range("C21").Value
Range("F17").Value = Address1
Range("F18").Value = Address2
Range("F19").Value = Address3
Range("F20").Value = Address4
Range("F21").Value = Address5
Application.ScreenUpdating = True
End Sub
Sub Nav_Month_YearUp()
Dim FinancialYear As String
Dim YearBeginning As Integer
Dim CurrentMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
YearBeginning = Int(Left(FinancialYear, 4))
YearBeginning = YearBeginning + 1
YearEnding = Int(Right(FinancialYear, 4))
YearEnding = YearEnding + 1
FinancialYear = CStr(YearBeginning) + "_" + CStr(YearEnding)
CurrentMonth = ActiveSheet.Range("B11")
DestinationSheet = Left((ActiveSheet.Range("B15")), 3)
If Not SheetExists(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet)
Then
Sheets(DestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(DestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = CurrentMonth
If DestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If DestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value = "Expenses"
Else
Sheets(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet).Select
End If
Application.ScreenUpdating = True
End Sub
Sub Nav_Month_YearDown()
Dim FinancialYear As String
Dim YearBeginning As Integer
Dim CurrentMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
YearBeginning = Int(Left(FinancialYear, 4))
YearBeginning = YearBeginning - 1
YearEnding = Int(Right(FinancialYear, 4))
YearEnding = YearEnding - 1
FinancialYear = CStr(YearBeginning) + "_" + CStr(YearEnding)
CurrentMonth = ActiveSheet.Range("B11")
DestinationSheet = Left((ActiveSheet.Range("B15")), 3)
If Not SheetExists(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet)
Then
Sheets(DestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(DestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = CurrentMonth
If DestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If DestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value = "Expenses"
Else
Sheets(FinancialYear + "_" + CurrentMonth + "_" + DestinationSheet).Select
End If
Application.ScreenUpdating = True
End Sub
Sub Nav_Month_Inc_Exp()
Dim FinancialYear As String
Dim YearBeginning As Integer
Dim CurrentMonth As String
Dim DestinationSheet As String
Dim NewDestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
CurrentMonth = ActiveSheet.Range("B11")
DestinationSheet = Left((ActiveSheet.Range("B15")), 3)
If DestinationSheet = "Inc" Then NewDestinationSheet = "Exp"
If DestinationSheet = "Exp" Then NewDestinationSheet = "Inc"
If Not SheetExists(FinancialYear + "_" + CurrentMonth + "_" +
NewDestinationSheet) Then
Sheets(NewDestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(NewDestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + CurrentMonth + "_" +
NewDestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = CurrentMonth
If NewDestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If NewDestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value =
"Expenses"
Else
Sheets(FinancialYear + "_" + CurrentMonth + "_" + NewDestinationSheet).Select
End If
Application.ScreenUpdating = True
End Sub
Sub Nav_MonthUp()
Dim FinancialYear As String
Dim YearBeginning As Integer
Dim YearEnding As Integer
Dim CurrentMonth As String
Dim NewMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
DestinationSheet = Left(ActiveSheet.Range("B15"), 3)
CurrentMonth = ActiveSheet.Range("B11")
Select Case CurrentMonth
Case "Jul"
NewMonth = "Aug"
Case "Aug"
NewMonth = "Sep"
Case "Sep"
NewMonth = "Oct"
Case "Oct"
NewMonth = "Nov"
Case "Nov"
NewMonth = "Dec"
Case "Dec"
NewMonth = "Jan"
Case "Jan"
NewMonth = "Feb"
Case "Feb"
NewMonth = "Mar"
Case "Mar"
NewMonth = "Apr"
Case "Apr"
NewMonth = "May"
Case "May"
NewMonth = "Jun"
Case "Jun"
NewMonth = "Jul"
End Select
YearBeginning = Int(Left(FinancialYear, 4))
YearBeginning = YearBeginning + 1
YearEnding = Int(Right(FinancialYear, 4))
YearEnding = YearEnding + 1
NewFinancialYear = CStr(YearBeginning) + "_" + CStr(YearEnding)
If NewMonth = "July" Then FinancialYear = NewFinancialYear
If Not SheetExists(FinancialYear + "_" + NewMonth + "_" + DestinationSheet)
Then
Sheets(DestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(DestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + NewMonth + "_" + DestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = NewMonth
If DestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If DestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value = "Expenses"
Else
Sheets(FinancialYear + "_" + NewMonth + "_" + DestinationSheet).Select
End If
Application.ScreenUpdating = True
End Sub
Sub Nav_MonthDown()
Dim FinancialYear As String
Dim YearBeginning As Integer
Dim YearEnding As Integer
Dim CurrentMonth As String
Dim NewMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
DestinationSheet = Left(ActiveSheet.Range("B15"), 3)
CurrentMonth = ActiveSheet.Range("B11")
Select Case CurrentMonth
Case "Jul"
NewMonth = "Jun"
Case "Jun"
NewMonth = "May"
Case "May"
NewMonth = "Apr"
Case "Apr"
NewMonth = "Mar"
Case "Mar"
NewMonth = "Feb"
Case "Feb"
NewMonth = "Jan"
Case "Jan"
NewMonth = "Dec"
Case "Dec"
NewMonth = "Nov"
Case "Nov"
NewMonth = "Oct"
Case "Oct"
NewMonth = "Sep"
Case "Sep"
NewMonth = "Aug"
Case "Aug"
NewMonth = "Jul"
End Select
YearBeginning = Int(Left(FinancialYear, 4))
YearBeginning = YearBeginning - 1
YearEnding = Int(Right(FinancialYear, 4))
YearEnding = YearEnding - 1
NewFinancialYear = CStr(YearBeginning) + "_" + CStr(YearEnding)
If NewMonth = "June" Then FinancialYear = NewFinancialYear
If Not SheetExists(FinancialYear + "_" + NewMonth + "_" + DestinationSheet)
Then
Sheets(DestinationSheet + "Template").Copy After:=Sheets(1)
Sheets(DestinationSheet + "Template (2)").Select
ActiveSheet.Name = FinancialYear + "_" + NewMonth + "_" + DestinationSheet
ActiveSheet.Range("B7").Value = FinancialYear
ActiveSheet.Range("B11").Value = NewMonth
If DestinationSheet = "Inc" Then ActiveSheet.Range("B15").Value = "Income"
If DestinationSheet = "Exp" Then ActiveSheet.Range("B15").Value = "Expenses"
Else
Sheets(FinancialYear + "_" + NewMonth + "_" + DestinationSheet).Select
End If
Application.ScreenUpdating = True
End Sub
Sub LockSheet()
On Error Resume Next
ActiveSheet.Protect Password:="Salesian"
End Sub
Sub UnLockSheet()
On Error Resume Next
ActiveSheet.Unprotect Password:="Salesian"
End Sub
Sub Edit_Category()
Dim FinancialYear As String
Dim CurrentMonth As String
Dim DestinationSheet As String
Application.ScreenUpdating = False
FinancialYear = ActiveSheet.Range("B7")
CurrentMonth = ActiveSheet.Range("B11")
DestinationSheet = ActiveSheet.Range("B15")
Sheets("Categories").Select
ActiveSheet.Range("A1") = FinancialYear
ActiveSheet.Range("A2") = CurrentMonth
ActiveSheet.Range("A3") = DestinationSheet
Application.ScreenUpdating = True
End Sub
Sub Nav_Cat_Month()
Dim NewDestinationSheet As String
Dim FinancialYear As String
Dim CurrentMonth As String
Dim DestinationSheet As String
FinancialYear = ActiveSheet.Range("A1")
CurrentMonth = ActiveSheet.Range("A2")
DestinationSheet = Left(ActiveSheet.Range("A3"), 3)
NewDestinationSheet = FinancialYear + "_" + CurrentMonth + "_" +
DestinationSheet
Sheets(NewDestinationSheet).Select
End Sub