ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   simple formula (https://www.excelbanter.com/excel-programming/316037-simple-formula.html)

pcscsr[_10_]

simple formula
 

All I need to do is code in vba the following formula:

=sum(d2*e2) and have the total in column f. The formula then i
copied down the column with the row changes. for example =sum(d3*e3
and so on. I know this is simple but I can't seem to get it right s
it goes down the column. Thank you for any help you can give me

--
pcscs
-----------------------------------------------------------------------
pcscsr's Profile: http://www.excelforum.com/member.php...fo&userid=1200
View this thread: http://www.excelforum.com/showthread.php?threadid=27604


routeram[_7_]

simple formula
 

Hi,

Why don't you try recording a macro and seeing the code that i
generated? It will clarify a lot of questions.

Regards,
Ra

--
routera
-----------------------------------------------------------------------
routeram's Profile: http://www.excelforum.com/member.php...fo&userid=1045
View this thread: http://www.excelforum.com/showthread.php?threadid=27604


Don Guillett[_4_]

simple formula
 
this idea should help

Sub balance()
Set frng = Range("h8:h" & Range("a65536").End(xlUp).Row)
With frng
.Formula = "=sum(d2*e2)"
' .Formula = .Value'changes the formula to a value only
End With
End Sub

--
Don Guillett
SalesAid Software

"pcscsr" wrote in message
...

All I need to do is code in vba the following formula:

=sum(d2*e2) and have the total in column f. The formula then is
copied down the column with the row changes. for example =sum(d3*e3)
and so on. I know this is simple but I can't seem to get it right so
it goes down the column. Thank you for any help you can give me.


--
pcscsr
------------------------------------------------------------------------
pcscsr's Profile:

http://www.excelforum.com/member.php...o&userid=12006
View this thread: http://www.excelforum.com/showthread...hreadid=276049




Dave Peterson[_4_]

simple formula
 
One more way based on the last row in column D:

Option Explicit
Sub testme01()
Dim myRng As Range
With ActiveSheet
Set myRng = .Range("F2:F" & .Cells(.Rows.Count, "D").End(xlUp).Row)
myRng.Formula = "=d2*e2"
End With
End Sub

You can plop the formula into the range all at once (like selecting the range,
typing in the formula and hitting ctrl-enter manually).

And you don't need that =sum() portion in your formula.
=d2*e2 is sufficient.

pcscsr wrote:

All I need to do is code in vba the following formula:

=sum(d2*e2) and have the total in column f. The formula then is
copied down the column with the row changes. for example =sum(d3*e3)
and so on. I know this is simple but I can't seem to get it right so
it goes down the column. Thank you for any help you can give me.

--
pcscsr
------------------------------------------------------------------------
pcscsr's Profile: http://www.excelforum.com/member.php...o&userid=12006
View this thread: http://www.excelforum.com/showthread...hreadid=276049


--

Dave Peterson



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

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