Enzo_Matrix
Board Regular
- Joined
- Jan 9, 2018
- Messages
- 113
I have created this code to help with our production schedule but the values are not returning what I would expect them to.
What is supposed to happen
A1: "Overdue"
B1: count of product past due
- Actual result is the word 'True'
C1: "Today"
D1: count for product due for completion today
E1: "This Week"
F1: count of product for next week
- Actual result is the word 'True'
If I put this directly into a cell it does generate the correct value
can someone please help me with my code to give actual values in cells B1, F1.
Code:
Sub ProductCount()'Create 3 headings of Overdue,Today,Next Week and sum data next to each heading
Dim OD As Range
Set OD = Sheets("Weld").Range("B1")
Dim TDY As Range
Set TDY = Sheets("Weld").Range("D1")
Dim TW As Range
Set TW = Sheets("Weld").Range("F1")
Sheets("Weld").Activate
ActiveSheet.Range("A1").Select
ActiveCell.Value = "Overdue"
With OD
.Formula = "=SUMIF($G:$G," > " & TODAY(),$F:$F)"
.Value = .Value
End With
ActiveSheet.Range("C1").Select
ActiveCell.Value = "Today"
With TDY
.Formula = "=Sumif($G:$G,Today(),$F:$F)"
.Value = .Value
End With
ActiveSheet.Range("E1").Select
ActiveCell.Value = "This Week"
With TW
.Formula = "=Sumif($G:$G," > " & TODAY(),$F:$F)"
.Value = .Value
End With
End Sub
What is supposed to happen
A1: "Overdue"
B1: count of product past due
- Actual result is the word 'True'
C1: "Today"
D1: count for product due for completion today
E1: "This Week"
F1: count of product for next week
- Actual result is the word 'True'
If I put this directly into a cell it does generate the correct value
Code:
=Sumif($G:$G," > " & TODAY(),$F:$F)
can someone please help me with my code to give actual values in cells B1, F1.
Last edited: