clarksonneo
02-04-2011, 10:01 PM
Hi,
I want a marco that can count the number of A in column C.
My code doesn't work.
There are 2 errors
1) C4:i .......I can't use the :
2) "A"..........I can't use the " "
There are 2 difficulties:
1) The no. of row is different from day to day, so I use i = "C" & Selection.End(xlDown).ROW
2) There will be some other text in column C ,says, after cells C13. So, I use Selection.End(xlDown).
Could you please amend my code so that I can produce the result I want?
Sub CountIf_A()
Range("C4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.End(xlDown).Offset(2, 1).Value = "No of A"
i = "C" & Selection.End(xlDown).ROW
Selection.Offset(3, 1).value = "=COUNTIF(C4:i, "A")"
End Sub
Thanks
I want a marco that can count the number of A in column C.
My code doesn't work.
There are 2 errors
1) C4:i .......I can't use the :
2) "A"..........I can't use the " "
There are 2 difficulties:
1) The no. of row is different from day to day, so I use i = "C" & Selection.End(xlDown).ROW
2) There will be some other text in column C ,says, after cells C13. So, I use Selection.End(xlDown).
Could you please amend my code so that I can produce the result I want?
Sub CountIf_A()
Range("C4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.End(xlDown).Offset(2, 1).Value = "No of A"
i = "C" & Selection.End(xlDown).ROW
Selection.Offset(3, 1).value = "=COUNTIF(C4:i, "A")"
End Sub
Thanks