yasarayhanka
09-04-2007, 02:15 PM
I have written this lenghty case statement but it is no good,
what I am trying to do is, in the spreadsheet you will see the numbers wiill be added every month for the current month and following months
I am trying to enter the formula in the cells below that will give the result of last months entry - previous months entry.
Thanks in advance for the help.
Yasar
here is some part of the vba code that I am using
Select Case range("n14").Value
Case ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-12]C-R[-13]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-11]C-R[-12]C"
End Select
Select Case range("n15")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-11]C-R[-12]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-10]C-R[-11]C"
End Select
Select Case range("n16")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-10]C-R[-11]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-9]C-R[-10]C"
End Select
Select Case range("n17")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-9]C-R[-10]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-8]C-R[-9]C"
End Select
Select Case range("n18")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-8]C-R[-9]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-7]C-R[-8]C"
End Select
Select Case range("n19")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-7]C-R[-8]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-6]C-R[-7]C"
End Select
Select Case range("n20")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-6]C-R[-7]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-5]C-R[-6]C"
End Select
Select Case range("n21")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-5]C-R[-6]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-4]C-R[-5]C"
End Select
Select Case range("n22")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-4]C-R[-5]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-3]C-R[-4]C"
End Select
what I am trying to do is, in the spreadsheet you will see the numbers wiill be added every month for the current month and following months
I am trying to enter the formula in the cells below that will give the result of last months entry - previous months entry.
Thanks in advance for the help.
Yasar
here is some part of the vba code that I am using
Select Case range("n14").Value
Case ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-12]C-R[-13]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-11]C-R[-12]C"
End Select
Select Case range("n15")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-11]C-R[-12]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-10]C-R[-11]C"
End Select
Select Case range("n16")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-10]C-R[-11]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-9]C-R[-10]C"
End Select
Select Case range("n17")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-9]C-R[-10]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-8]C-R[-9]C"
End Select
Select Case range("n18")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-8]C-R[-9]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-7]C-R[-8]C"
End Select
Select Case range("n19")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-7]C-R[-8]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-6]C-R[-7]C"
End Select
Select Case range("n20")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-6]C-R[-7]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-5]C-R[-6]C"
End Select
Select Case range("n21")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-5]C-R[-6]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-4]C-R[-5]C"
End Select
Select Case range("n22")
Case Is = ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-4]C-R[-5]C"
Case Is <> ""
range("n25").Select
ActiveCell.FormulaR1C1 = "=R[-3]C-R[-4]C"
End Select