PDA

View Full Version : Solved: UF countif in range



Emoncada
11-26-2012, 12:44 PM
I have a userform that I would like to figure out how to do the following.
I want to be able to get a count of how many times a value is found in a range and display it in the userform.

So in the userform I have a lblticket.caption which has a value.
I want to look at the "Complete" sheet Range(G:G) and return a count and display it in lblUnits.caption

magelan
11-26-2012, 12:51 PM
Pretty impressive post count. Do you code much?



pseudocode
for each varcell in Sheets("Complete").usedrange.cells
if the variable i want to count is there
count ++
next
lblunits.caption = count

Bob Phillips
11-26-2012, 03:55 PM
lblUnits.caption = Application.Countif(Worksheets("Complete").Columns("G"), "value")

Emoncada
11-26-2012, 04:14 PM
Hey XLD i am getting Run-time error '438'
Object doesn't support this property or method

Any ideas why?

Emoncada
11-26-2012, 04:14 PM
Nevermind I had a typo. That Worked XLD

Emoncada
11-29-2012, 02:39 PM
I noticed a problem now with this.
I am getting a 1 value even when no the value is not located.
How can I have it show a 0 when not found?

Emoncada
11-29-2012, 02:59 PM
Nevermind I found the problem