View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Simple Multiplication Formula

Hi MP,

No it is not you it is me. You started by putting a value in the cell but
switched halfway along, and I missed that point. Sorry about that.

You are absolutely right, you are inserting a formula, not a value. And even
though Value and Formula both work, in my philosophy I would suggest you
therefore use Formula not Value as it signifies the code's intent as well as
working.

And hopefully, I gave you the relative cell addresses as you wanted :-)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"MP" wrote in message
...
Hi Bob,
Guess since I'm new to excel, I don't have the terminology straight...
I thought my intent was to place a formula into the cell.

I was thinking when I put in a cell (for example manually type the
following) "= somecelladdress * othercelladdress" that I was entering a
formula...?

...because I can then copy that cell content, and paste special...

if I select Formula I get the "formula" (adjusted per row/col)
if I select Value, I get the resultant value of the formula, but not the
formula itself.

So maybe I'm confusing the terms somehow???

Any way, both .Value and .Formula appear to place the same 'contents' into
the target cell, which is exactly what i'm looking for.

So thanks again to both of you for your inputs.
Mark



"Bob Phillips" wrote in message
...
But it is a value not a formula. Formula might work, but Value helps
explain the intent

Public Function MultiplyCells(RowIdx As Long, _
ColOne As Long, _
ColTwo As Long, _
ResultCol As Long, _
oWs As Worksheet) As Boolean
With oWs
.Cells(RowIdx, ResultCol).Value= "=" & _
.Cells(RowIdx, ColOne).Address(False, False) & "*" & _
.Cells(RowIdx, ColTwo).Address(False, False)
End With
End Function

--
---
HTH

Bob