View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA for calucation instead row/cell reference

Application.Countif(Range("R3:R5000"),1)


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Jan" wrote in message
...
Hello All,

I would like to calculate a range via VBA instead of referencing the
range/cell from the worksheet. How would I write the code in VBA to do

the
following formula calculations that are in a cell off to the side from the
data of the worksheet?
=countif(R3:r5000,1)
=subtotal(3, C3:c5000)

In VBA, I have the range/cell reference, but would like to just use the
formula in the code instead of on the worksheet. See below code.

Format(Date, "mmm d, yyyy") & Chr(10) & "Number of Projects in List =" & "

"
& Range("w2") _
& Chr(10) & "Assignments: Mike=" & Range("x2")

TIA - Jan