ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using a variable in a formula (https://www.excelbanter.com/excel-discussion-misc-queries/124027-using-variable-formula.html)

[email protected]

Using a variable in a formula
 
Hi,

I am trying to use a range variable in a formula for a cell.
The code i have currently is:

rct = Selection.CurrentRegion.Rows.Count + 3
Range("e" & rct + 1).Formula = "=sum("e5:e" & rct)"

The rows would vary depending on sheets used.
Is this possible?


[email protected]

Using a variable in a formula
 
Never mind. Realised my mistake soon after posting :)



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

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