Hello,
I'm pretty busy with an advanced excel sheet but I'm stuck with at the moment with one of my last VBA codes.
I'm using the following code:
Sub MG15Sep58()
Dim Budget As Double
Dim rTime As Long
Dim sMth As Long
Dim n As Long
Dim c As Long
Dim Lst As Integer
Dim st As Long
Lst = Range("C" & Rows.Count).End(xlUp).Row
If Lst >= 19 Then Range("C19").Resize(Lst - 18, 2).ClearContents
Budget = Range("C9"): rTime = Range("C10"): sMth = Range("C11")
c = 19
st = sMth - 1
For n = c To c + rTime - 1
Cells(n + st, 2) = MonthName(sMth)
Cells(n + st, 3) = Budget / rTime
sMth = sMth + 1
If sMth = 13 Then sMth = 1
Next n
End Sub
and in the next macro i'm using almost the same code but with a different input:
Sub MG15Sep59()
Dim Budget As Double
Dim rTime As Long
Dim sMth As Long
Dim n As Long
Dim c As Long
Dim Lst As Integer
Dim st As Long
Lst = Range("C" & Rows.Count).End(xlUp).Row
If Lst >= 19 Then Range("C19").Resize(Lst - 18, 2).ClearContents
Budget = Range("C15"): rTime = Range("C16"): sMth = Range("C17")
c = 19
st = sMth - 1
For n = c To c + rTime - 1
Cells(n + st, 2) = MonthName(sMth)
Cells(n + st, 3) = BudgetE / rTime
sMth = sMth + 1
If sMth = 13 Then sMth = 1
Next n
End Sub
When I try to get the results it is overwriting each other. The perfect situation is that he adds it to to other results
example:
if there is 0 and you need to add 20 the end result is 20
if there is 20 and you need to add 20 the end result is 40.
I'm pretty busy with an advanced excel sheet but I'm stuck with at the moment with one of my last VBA codes.
I'm using the following code:
Sub MG15Sep58()
Dim Budget As Double
Dim rTime As Long
Dim sMth As Long
Dim n As Long
Dim c As Long
Dim Lst As Integer
Dim st As Long
Lst = Range("C" & Rows.Count).End(xlUp).Row
If Lst >= 19 Then Range("C19").Resize(Lst - 18, 2).ClearContents
Budget = Range("C9"): rTime = Range("C10"): sMth = Range("C11")
c = 19
st = sMth - 1
For n = c To c + rTime - 1
Cells(n + st, 2) = MonthName(sMth)
Cells(n + st, 3) = Budget / rTime
sMth = sMth + 1
If sMth = 13 Then sMth = 1
Next n
End Sub
and in the next macro i'm using almost the same code but with a different input:
Sub MG15Sep59()
Dim Budget As Double
Dim rTime As Long
Dim sMth As Long
Dim n As Long
Dim c As Long
Dim Lst As Integer
Dim st As Long
Lst = Range("C" & Rows.Count).End(xlUp).Row
If Lst >= 19 Then Range("C19").Resize(Lst - 18, 2).ClearContents
Budget = Range("C15"): rTime = Range("C16"): sMth = Range("C17")
c = 19
st = sMth - 1
For n = c To c + rTime - 1
Cells(n + st, 2) = MonthName(sMth)
Cells(n + st, 3) = BudgetE / rTime
sMth = sMth + 1
If sMth = 13 Then sMth = 1
Next n
End Sub
When I try to get the results it is overwriting each other. The perfect situation is that he adds it to to other results
example:
if there is 0 and you need to add 20 the end result is 20
if there is 20 and you need to add 20 the end result is 40.