ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   syntax problem (https://www.excelbanter.com/excel-programming/356472-syntax-problem.html)

dorre

syntax problem
 
hello to all

I have a code line...
ActiveCell.Formula = "=COUNT(P5:P15)"

But the rowOffset won't always be 10. I've defined a rowOffset, called
RowOff, but I can't get the syntax to work with the COUNT function?
Something like ...

ActiveCell.Formula = "=COUNT(P5:P ***RowOff goes in here somehow*** )"


thanks
Dorre







Gary Keramidas

syntax problem
 
try
ActiveCell.Formula = "=COUNT(P5:P" & RowOff & ")"

--


Gary


"dorre" wrote in message
...
hello to all

I have a code line...
ActiveCell.Formula = "=COUNT(P5:P15)"

But the rowOffset won't always be 10. I've defined a rowOffset, called
RowOff, but I can't get the syntax to work with the COUNT function? Something
like ...

ActiveCell.Formula = "=COUNT(P5:P ***RowOff goes in here somehow*** )"


thanks
Dorre









dorre

syntax problem
 
Close, but this evaluates to: ActiveCell.Formula = "=COUNT(P5:P10)"

I need to understand the syntax in adding an offset (rowOff) of, say 10, to
P5, resulting in an expression equivalent to: ActiveCell.Formula =
"=COUNT(P5:P15)"

Thanks. Dorre

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
try
ActiveCell.Formula = "=COUNT(P5:P" & RowOff & ")"

--


Gary


"dorre" wrote in message
...
hello to all

I have a code line...
ActiveCell.Formula = "=COUNT(P5:P15)"

But the rowOffset won't always be 10. I've defined a rowOffset, called
RowOff, but I can't get the syntax to work with the COUNT function?
Something like ...

ActiveCell.Formula = "=COUNT(P5:P ***RowOff goes in here
mehow*** )"


thanks
Dorre











Gary Keramidas

syntax problem
 
in this example, i just set RowOff to 10 for testing, is this what you want?

this will count p5:p20
Sub test()
RowOff = 10
ActiveCell.Formula = "=COUNT(P5:P" & 10 + RowOff & ")"
End Sub

--


Gary


"dorre" wrote in message
...
Close, but this evaluates to: ActiveCell.Formula = "=COUNT(P5:P10)"

I need to understand the syntax in adding an offset (rowOff) of, say 10, to
P5, resulting in an expression equivalent to: ActiveCell.Formula =
"=COUNT(P5:P15)"

Thanks. Dorre

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
try
ActiveCell.Formula = "=COUNT(P5:P" & RowOff & ")"

--


Gary


"dorre" wrote in message
...
hello to all

I have a code line...
ActiveCell.Formula = "=COUNT(P5:P15)"

But the rowOffset won't always be 10. I've defined a rowOffset, called
RowOff, but I can't get the syntax to work with the COUNT function?
Something like ...

ActiveCell.Formula = "=COUNT(P5:P ***RowOff goes in here mehow*** )"


thanks
Dorre














All times are GMT +1. The time now is 11:30 PM.

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