Hi guys,
I am trying to write a code that can count the number of letter "u" between two cells.
a = 32
b = 40
C = 35
[VBA]Cells(C, "Z") = "=COUNTIF(Range(Cells(35,a),Cells(35,b)),""u"")"[/VBA]
Not working !! what I am doing wrong?
Hi guys,
I am trying to write a code that can count the number of letter "u" between two cells.
a = 32
b = 40
C = 35
[VBA]Cells(C, "Z") = "=COUNTIF(Range(Cells(35,a),Cells(35,b)),""u"")"[/VBA]
Not working !! what I am doing wrong?
Is this what you mean
Cells(C, "Z") = Application.CountIf(Range(Cells(a, "A"), Cells(b, "A")), "u")
Last edited by Aussiebear; 04-09-2023 at 04:35 AM. Reason: Adjusted the code tags
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks Xld,
so the trick was to use application.
Just curious, why recording a macro doesn't use "Application."?
Because recording puts the formula into the formula property, you were trying to stuff it into value, but even then not using the correct values.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber