Hi guys
Sorry if this has been covered before, I trawled through as many threads as possible to try and resolve before posting.
I have a sub trying to populate metrics from a worksheet of raw data and inherited it with various excel formulae embedded in subsequent sheets. My solution so far works ok to a point, but for some reason when I start the next phase of the code, I'm not getting the results I expect. I've copied the sub initial dim lines and the first lines of the code that work ok. In the second extract i've copied in the line i'm having trouble with. Grateful for any help with possible solutions.
Sub MetricsPop()
Dim cumugp1flow As Long, numofgp1 As Integer, numoftasks As Integer, avallocflow As Double, avalloctouch As Double, nrow As Integer
Dim avgp1touch As Double, startweek As Date, endweek As Date, inwkallocflowtotal As Double, wkavalloctouch As Double, prevwkavalloctouch As Double
Dim wknumoftasks As Integer
'Find the number of rows
nrow = Worksheets("RawData").Cells(3, 1).End(xlDown).Row
'Update details with the number of tasks received
numoftasks = Application.WorksheetFunction.CountIf(ActiveWorkbook.Worksheets("RawData").Range("B3:B" & nrow), "<>")
Worksheets("Sheet1").Shapes("Rounded Rectangle 390").TextFrame.Characters.Text = numoftasks
'Now get weekly stats - start by establishing the start and end date of the current week
startweek = Date - ((Weekday(Date, vbMonday) - 1))
endweek = Date - Weekday(Date, vbMonday) + 5
'Update with the number of tasks received that week
wknumoftasks = Application.WorksheetFunction.CountIfs(ActiveWorkbook.Worksheets("RawData").Range("B3:B" & nrow), "<>", ActiveWorkbook.Worksheets("RawData").Range("S3:S" & nrow), ">" & startweek)
Worksheets("Sheet1").Shapes("Rounded Rectangle 65").TextFrame.Characters.Text = wknumoftasks
p.s. first post, so apologies if I've posted this wrong!
Bookmarks