ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA for calucation instead row/cell reference (https://www.excelbanter.com/excel-programming/361416-vba-calucation-instead-row-cell-reference.html)

Jan

VBA for calucation instead row/cell reference
 
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

Bob Phillips[_6_]

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





All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com