assigning value in macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
When I want a value for of a formula for my macro I write the formula to go
in a blank cell eg range("a1") ="= countif("b:b",b1)" then use myvalue =
range("a1") how do I assign countif to myvalue without doing this?
Thanks
Tina
 
myValue = Application.COUNTIF(Range("B:B"),Range("B1"))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Hi Tina !! :)
Try this. It should work.

range("a1") = chr(34) & "=countif(" & chr(34) &"b:b" & chr(34)& ",b1)"&
chr(34)
Could you let me know if it solves your problem ?
My e-mail ID is (e-mail address removed)
 
Or:

dim myVal as long
with activesheet
myval = application.countif(.range("b:b"),.range("b1").value)
end with
msgbox myval
 
Thanks Bob.......

Your suggestion helped me TODAY, 11/29/09!!.......4 1/2 years after you
posted it!

Vaya con Dios,
Chuck, CABGx3
 

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

Similar Threads

Write to intersect of a row and column 7
Excel Need Countifs Formula Help 0
loop issue 3
File Naming 2
Macro doesnt work properly 2
Run Macro If Cell have "x" value 0
if then and do - DA 2
Compare values of cells in a range 5

Back
Top