Good day Forum members,
I hope you are all doing well. As I’m new to VBA, I’m looking for some assistance to formulate my code using ANDIF (assuming ANDIF is the right condition).
I would like to be able to count the number of rows in my WS that meets two conditions. First, a specific word in column A (range A1:A300). Then, if the date in column B (range B1:B300) is <=> than today.
Example: if the text “Tp A” is in A5 and its corresponding date in B5 is < today then count them and write that number in cell A305. If the text “Tp A” is in A10 and its corresponding date in B10 is = today then count them and write that number in cell A306. If the text “Tp A” is in A111 and its corresponding date in A111 is > today then count them and write that number un cell A307.
The same thing would apply for other text such as “Tp B” and other with the information in B305, 306, 307 and so on for the remainder.
I managed to come up with the following code but obviously it is beyond my capability.
Any help on the matter would be much appreciated. Thank you kindly.
I hope you are all doing well. As I’m new to VBA, I’m looking for some assistance to formulate my code using ANDIF (assuming ANDIF is the right condition).
I would like to be able to count the number of rows in my WS that meets two conditions. First, a specific word in column A (range A1:A300). Then, if the date in column B (range B1:B300) is <=> than today.
Example: if the text “Tp A” is in A5 and its corresponding date in B5 is < today then count them and write that number in cell A305. If the text “Tp A” is in A10 and its corresponding date in B10 is = today then count them and write that number in cell A306. If the text “Tp A” is in A111 and its corresponding date in A111 is > today then count them and write that number un cell A307.
The same thing would apply for other text such as “Tp B” and other with the information in B305, 306, 307 and so on for the remainder.
I managed to come up with the following code but obviously it is beyond my capability.
VBA Code:
Private Sub Workbook_Open()
Range("A305") = WorksheetFunction.CountIf(Range("A:A"), "Tp A")
End Sub