Doing a 'countif' but I just want the value not the formula

S

ste mac

Hi There, can anybody help me with this one please:
I am no programmer but the macro below sticks a countif
formula in each cell as requested, but this makes the wb
slow to update (as it calcs of each cell) is there anyway
I can change it so it calcs the countif but just places the
amount it counts in each cell instead of the formulae?
Thanks for any help
seeya ste

Public Sub howmany()
Dim xlrow As Long

thedata = "DV3:EJ65000"
xlrow = 2150

Do While Not ActiveSheet.Cells(xlrow, 70).Value = ""

ActiveSheet.Cells(xlrow, 73).Formula = "=countif(" & thedata & ", " &
ActiveSheet.Cells(xlrow, 70).Value & ")"

xlrow = xlrow + 1
Application.StatusBar = xlrow
Loop
Application.StatusBar = False
End Sub
 
F

Frank Kabel

Hi
after the line
ActiveSheet.Cells(xlrow, 73).Formula = "=countif(" & thedata & ", " &
ActiveSheet.Cells(xlrow, 70).Value & ")"

add the line
ActiveSheet.Cells(xlrow, 73).value=ActiveSheet.Cells(xlrow, 73).value
 
B

Bob Phillips

or even

ActiveSheet.Cells(xlrow, 73).Value = Application.CountIf(Range(theData),
ActiveSheet.Cells(xlrow, 70).Value)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top