ashwin1206
New Member
- Joined
- Mar 13, 2018
- Messages
- 1
[FONT="]Hello Experts[/FONT]
[FONT="]I am new to vba and very keen in understanding it better. I have written below code around countifs[/FONT]
[FONT="]Issue 1 - When i debug, i do not get any error, instead i get output as '0' even though my input file looks as below. However if i copy paste the keyword 'Walkthrough' in the code and execute it, i would get the correct output i.e 2[/FONT]
[FONT="]Issue 2 - If I assign a button to this macro and run, i would get an output as '0'[/FONT]
[FONT="]Input File[/FONT]
[FONT="]Walkthrough Not Started[/FONT]
[FONT="]Walkthrough Not Started[/FONT]
[FONT="]Actual Code[/FONT]
[FONT="]Sub countif_test()
Dim type_of_test As Long
Dim Walk As Worksheet
Dim source As Worksheet
Set source = Worksheets("Archer Search Report")
Set Walk = Worksheets("SOX_Dashboard_Walkthrough_Stat")
type_of_test = Application.WorksheetFunction.CountIfs(Range("A2:A3"), "Interim", Range("B2:B3"), "Not Started")
Walk.Range("C2") = type_of_test
End Sub[/FONT]
[FONT="]Request you to assist in regard this. Thanks in advance.[/FONT]
[FONT="]I am new to vba and very keen in understanding it better. I have written below code around countifs[/FONT]
[FONT="]Issue 1 - When i debug, i do not get any error, instead i get output as '0' even though my input file looks as below. However if i copy paste the keyword 'Walkthrough' in the code and execute it, i would get the correct output i.e 2[/FONT]
[FONT="]Issue 2 - If I assign a button to this macro and run, i would get an output as '0'[/FONT]
[FONT="]Input File[/FONT]
[FONT="]Walkthrough Not Started[/FONT]
[FONT="]Walkthrough Not Started[/FONT]
[FONT="]Actual Code[/FONT]
[FONT="]Sub countif_test()
Dim type_of_test As Long
Dim Walk As Worksheet
Dim source As Worksheet
Set source = Worksheets("Archer Search Report")
Set Walk = Worksheets("SOX_Dashboard_Walkthrough_Stat")
type_of_test = Application.WorksheetFunction.CountIfs(Range("A2:A3"), "Interim", Range("B2:B3"), "Not Started")
Walk.Range("C2") = type_of_test
End Sub[/FONT]
[FONT="]Request you to assist in regard this. Thanks in advance.[/FONT]