ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax question (https://www.excelbanter.com/excel-programming/284321-syntax-question.html)

Stuart[_5_]

Syntax question
 
Some help, please:

ActiveCell.Offset(0, 1).Formula = _
"=Sum(G4: ...........G.?....)"

where G? can be defined as the cell:
ActiveCell.Offset(-2, 1)

As I get older, I forget even the simplest of things!

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003



Dianne

Syntax question
 
ActiveCell.Offset(0, 1).Formula = _
"=Sum($G$4:" & ActiveCell.Offset(-2, 1).Address & ")"

--
HTH,
Dianne

In ,
Stuart typed:
Some help, please:

ActiveCell.Offset(0, 1).Formula = _
"=Sum(G4: ...........G.?....)"

where G? can be defined as the cell:
ActiveCell.Offset(-2, 1)

As I get older, I forget even the simplest of things!

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003




Tom Ogilvy

Syntax question
 
Some help, please:

ActiveCell.Offset(0, 1).Formula = _
"=Sum(G4:G" & ActiveCell.Offset(-2,1) & ")"

if you want it hard coded. If you want your formula to dynamically refer to
this cell

"=Sum(Indirect(""G4:G"" & " & ActiveCell.Offset(-2,1).Address(0,0) & "))"


? "=Sum(Indirect(""G4:G"" & " & ActiveCell.Offset(-2,1).Address(0,0) &
"))"
=Sum(Indirect("G4:G" & E97))

so if E97 contained 100 then the sum would sum G4:G100


--
Regards,
Tom Ogilvy


"Stuart" wrote in message
...
Some help, please:

ActiveCell.Offset(0, 1).Formula = _
"=Sum(G4: ...........G.?....)"

where G? can be defined as the cell:
ActiveCell.Offset(-2, 1)

As I get older, I forget even the simplest of things!

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003





Stuart[_5_]

Syntax question
 
Many thanks to you both.

Forgot the need for 'Address'

Regards.

"Dianne" wrote in message
...
ActiveCell.Offset(0, 1).Formula = _
"=Sum($G$4:" & ActiveCell.Offset(-2, 1).Address & ")"

--
HTH,
Dianne

In ,
Stuart typed:
Some help, please:

ActiveCell.Offset(0, 1).Formula = _
"=Sum(G4: ...........G.?....)"

where G? can be defined as the cell:
ActiveCell.Offset(-2, 1)

As I get older, I forget even the simplest of things!

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003




All times are GMT +1. The time now is 10:29 AM.

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