Is it possible to create a macro to delete code from antoher macro on certain date, for example here is a samlple of my code:
Application.DisplayAlerts = False
Workbooks.Open Filename:="R:\ACCT\FINREPORTING\FS2011\Ratios\CAPX Ratios\Indebtedness.xlsx", UpdateLinks:=3
Windows("Enterprise KPI's.XLSM").Activate
Sheets("DEBT").Select
If Range("N16").Value = 1 Then
Range("N2").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$7"
Range("N3").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$8"
Range("N4").Formula = "=[Indebtedness.xlsx]Schedule_Jun'!$E$9"
Range("N8").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$13"
Range("N9").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$14"
Range("N10").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$15"
Range("N11").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$16"
Range("N12").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$17"
Else
Range("N2").Formula = "=L2"
Range("N3").Formula = "='Cash Flow Projection'!EG42/1000"
Range("N4").Formula = "=L4"
Range("N8").Formula = "=SUM('[2011 Balance Sheet by Month.xlsx]BS'!$BV$55+'[2011 Balance Sheet by Month.xlsx]BS'!$BV$61)"
Range("N9").Formula = "=L9"
Range("N10").Formula = "=L10"
Range("N11").Formula = "=L11"
Range("N12").Formula = "=L12"
End If
If Range("P16").Value = 1 Then
Range("P2").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$7"
Range("P3").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$8"
Range("P4").Formula = "=[Indebtedness.xlsx]Schedule_Jul'!$E$9"
Range("P8").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$13"
Range("P9").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$14"
Range("P10").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$15"
Range("P11").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$16"
Range("P12").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$17"
Else
After June, I would like to delete all the lines that refer to the ranges in N. After July I would like to delete all the lines that refer to range P. I know I can manually delete, however, I have extensive amount of code and would like to create the macro to run.
Thank You
Tony
Application.DisplayAlerts = False
Workbooks.Open Filename:="R:\ACCT\FINREPORTING\FS2011\Ratios\CAPX Ratios\Indebtedness.xlsx", UpdateLinks:=3
Windows("Enterprise KPI's.XLSM").Activate
Sheets("DEBT").Select
If Range("N16").Value = 1 Then
Range("N2").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$7"
Range("N3").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$8"
Range("N4").Formula = "=[Indebtedness.xlsx]Schedule_Jun'!$E$9"
Range("N8").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$13"
Range("N9").Formula = "=[Indebtedness.xlsx]Schedule_Jun!$E$14"
Range("N10").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$15"
Range("N11").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$16"
Range("N12").Formula = "[Indebtedness.xlsx]Schedule_Jun!$E$17"
Else
Range("N2").Formula = "=L2"
Range("N3").Formula = "='Cash Flow Projection'!EG42/1000"
Range("N4").Formula = "=L4"
Range("N8").Formula = "=SUM('[2011 Balance Sheet by Month.xlsx]BS'!$BV$55+'[2011 Balance Sheet by Month.xlsx]BS'!$BV$61)"
Range("N9").Formula = "=L9"
Range("N10").Formula = "=L10"
Range("N11").Formula = "=L11"
Range("N12").Formula = "=L12"
End If
If Range("P16").Value = 1 Then
Range("P2").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$7"
Range("P3").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$8"
Range("P4").Formula = "=[Indebtedness.xlsx]Schedule_Jul'!$E$9"
Range("P8").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$13"
Range("P9").Formula = "=[Indebtedness.xlsx]Schedule_Jul!$E$14"
Range("P10").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$15"
Range("P11").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$16"
Range("P12").Formula = "[Indebtedness.xlsx]Schedule_Jul!$E$17"
Else
After June, I would like to delete all the lines that refer to the ranges in N. After July I would like to delete all the lines that refer to range P. I know I can manually delete, however, I have extensive amount of code and would like to create the macro to run.
Thank You
Tony