ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluating a cell (https://www.excelbanter.com/excel-programming/284822-evaluating-cell.html)

Phillip2001

Evaluating a cell
 
if the content of a cell is the string made up of ="=sum(d3."&"d"&"1000)" which shows up as =sum(d3.d1000) how would one actually evaluate this in another cell so it would show the sum of the column d from cell 3 to 1000. Is there no eval(c1) or equivalent...

dcottrell505

Evaluating a cell
 

Phillip,

Not sure what you're asking in terms of the string, but here's some
code to sum a column.

dc

Sub sum_column()

'select the range of cells you want to sum
Range("D3:D1000").Select
'activate the cell where you want to show the answer
Range("D1001").Activate
'write the answer using references rows in relation to the output cell
ActiveCell.FormulaR1C1 = "=SUM(R[-998]C:R[-1]C)"

End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

Gord Dibben

Evaluating a cell
 
Try this UDF

Function EvalCell(RefCell As String)
EvalCell = Evaluate(RefCell)
End Function

Usage is: =EvalCell(cellref)

Where cellref contains =SUM(D3:D1000) or simply SUM(D3:D1000) or A1 + A2

Gord Dibben XL2002

On Mon, 8 Dec 2003 16:46:04 -0800, "Phillip2001" wrote:

if the content of a cell is the string made up of ="=sum(d3."&"d"&"1000)" which shows up as =sum(d3.d1000) how would one actually evaluate this in another cell so it would show the sum of the column d from cell 3 to 1000. Is there no eval(c1) or equivalent...




All times are GMT +1. The time now is 07:01 PM.

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