Hi,
I have the following code.
However, it would not run - I got the following error message:
Compile Error:
Invalid qualifier.
Wonder if someone could point what the error is.
Thank you!
you!
I have the following code.
However, it would not run - I got the following error message:
Compile Error:
Invalid qualifier.
Wonder if someone could point what the error is.
Thank you!
Code:
Sub update_MTD()
Dim minus_day As Integer, sessionDate As String, current_Month As Integer, previous_Month As Integer
minus_day = get_Minus_Day()
sessionDate = get_SessionDate(minus_day)
current_Month = Month(sessionDate)
previous_Month = current_Month - 1
Dim startRow_current As Long, endRow_current As Long, startRow_prev As Long, endRow_prev As Long
With ThisWorkbook.Worksheets("Totals")
startRow_current = .Range("A:A").Find(what:="current_Month", after:=ThisWorkbook.Worksheets("Totals").Range("A1")).Row
endRow_current = .Range("A:A").Find(what:="current_Month", after:=ThisWorkbook.Worksheets("Totals").Range("A1"), searchdirection:=xlPrevious).Row
startRow_prev = .Range("A:A").Find(what:="previous_Month", after:=ThisWorkbook.Worksheets("Totals").Range("A1")).Row
endRow_prev = .Range("A:A").Find(what:="previous_Month", after:=ThisWorkbook.Worksheets("Totals").Range("A1"), searchdirection:=xlPrevious).Row
End With
Set rng_Current_MTD = ThisWorkbook.Worksheets("Totals").Range("C" & startRow_current.Row, "C" & endRow_current.Row)
Current_MTD = WorksheetFunction.Sum(rng_Current_MTD)
End Sub