Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
shternm
 
Posts: n/a
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
Alan
 
Posts: n/a
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
shternm
 
Posts: n/a
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
Alan
 
Posts: n/a
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default 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).


  #7   Report Post  
Posted to microsoft.public.excel.misc
shternm
 
Posts: n/a
Default 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

  #8   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default 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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I enter a formula in a comment? Trident Excel Worksheet Functions 2 June 30th 05 03:56 PM
Trying to enter a range of numbers using >1 and < 5 in a formula Mel9970 Excel Worksheet Functions 1 March 29th 05 08:52 PM
Formula for Excel: C3-AC3, then C3-C25...how do I enter it? Lisa P Excel Worksheet Functions 1 March 8th 05 12:12 AM
Aligning Two Lists in Excel Rich Excel Discussion (Misc queries) 2 December 4th 04 05:44 PM
Can you enter a formula in a cell that auto-inputs calculations a. proactive Excel Worksheet Functions 4 November 9th 04 05:00 AM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"