Can I get formula's to work in Powerpoint (excel cut and paste)

G

Garrydene

I want to copy from excel a small group of cells that have numbers and
calculations and then I want to paste then into Powerpoint and when I am
presenting my powerpoint slide show I want to be able to change a number and
have the values change because the calculation uses the number I typed in.
 
E

Eduardo

Hi Bill,

Thanks for the sample...

How can you add values (vs. multiple)? I am finding that placing a plus (+)
concatenate the values entered in the fields. Please see the following below:

Your help as always is appreciated.

Ed


Private Sub Clear_Click()
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
End Sub

Private Sub Calculate_Click()
On Error GoTo Err1
TextBox5.Value = (TextBox1.Value) + (TextBox2.Value) + (TextBox3.Value) +
(TextBox4.Value)
GoTo Done
Err1:
MsgBox "You must enter numbers in both P&I, Life Ins, Taxes, and HOA before
calculating", vbOKOnly, "Calculating Error Message"
Done:
End Sub
 
B

Bill Foley

Seems weird that you can multiply textbox values fine but not add them.
That is because VBA is smart enough to know that when you want to multiply
something in two textboxes that they are really numbers, but when you add
them they could be text strings instead of numbers. With that said, you
need to use the "val" function:

TextBox5.Value = val(TextBox1.Value) + val(TextBox2.Value) +
val(TextBox3.Value) + val(TextBox4.Value)

This tells VBA to treat the text as values. For example, if TextBox1 held
"Bill" and TextBox2 held "Foley", the following would result in:

TextBox1 + TextBox2 = BillFoley

Hope that helps! Got to get back to class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top