![]() |
How to enter value of a formula in vba
Please help I am not sure why .Value does not work for me. Do While ActiveCell.Offset(0, 1).Value < Empty ActiveCell*.Value* = "=If(R[0]C[1]<R[0]C[2],R[0]C[1]&"" ""&R[0]C[2],R[0]C[2]&"" ""&R[0]C[2])" ActiveCell.Offset(1, 0).Select Loop -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 |
How to enter value of a formula in vba
Try
ActiveCell.Formula = "=If(R[0]C[1]<R[0]C[2],R[0]C[1]&"" ""&R[0]C[2],R[0]C[2]&"" ""&R[0]C[2])" Regards, Alan. "shternm" wrote in message ... Please help I am not sure why .Value does not work for me. Do While ActiveCell.Offset(0, 1).Value < Empty ActiveCell*.Value* = "=If(R[0]C[1]<R[0]C[2],R[0]C[1]&"" ""&R[0]C[2],R[0]C[2]&"" ""&R[0]C[2])" ActiveCell.Offset(1, 0).Select Loop -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 |
How to enter value of a formula in vba
That doesn't work either. Just so I am making myself clear: I don't want to see the formula in the cell just a result (value). -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 |
How to enter value of a formula in vba
Apologies,
I didn't look carefully enough at your query. I see now what you mean. I would repost this in 'Programming', The VB experts are there although I'm not sure this can be done directly in code, it may have to refer to a worksheet formula, I'll look forward to the answers, Good Luck, Regards, Alan. "shternm" wrote in message ... That doesn't work either. Just so I am making myself clear: I don't want to see the formula in the cell just a result (value). -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 |
How to enter value of a formula in vba
Maybe activecell.formular1c1 would work.
shternm wrote: Please help I am not sure why .Value does not work for me. Do While ActiveCell.Offset(0, 1).Value < Empty ActiveCell*.Value* = "=If(R[0]C[1]<R[0]C[2],R[0]C[1]&"" ""&R[0]C[2],R[0]C[2]&"" ""&R[0]C[2])" ActiveCell.Offset(1, 0).Select Loop -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 -- Dave Peterson |
How to enter value of a formula in vba
Try:
With ActiveCell .FormulaR1C1 = "=If(R[0]C[1]<R[0]C[2],R[0]C[1]&""""&" _ & "R[0]C[2],R[0]C[2]&"" ""&R[0]C[2])" .Value = .Value End With Hope this helps Rowan shternm wrote: That doesn't work either. Just so I am making myself clear: I don't want to see the formula in the cell just a result (value). |
How to enter value of a formula in vba
Thank you - that works great. Can you explain why that works? -- shternm ------------------------------------------------------------------------ shternm's Profile: http://www.excelforum.com/member.php...nfo&userid=858 View this thread: http://www.excelforum.com/showthread...hreadid=486065 |
How to enter value of a formula in vba
The code inserts the formula into the cell and then replaces the formula
with the value of the cell. So it works a bit like typing in the formula and then doing a copy pastespecial values over the formula. Regards Rowan shternm wrote: Thank you - that works great. Can you explain why that works? |
All times are GMT +1. The time now is 06:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com