Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default Formula appearing instead of result

I have the following code in a macro
If Range("g" & x - 1) 2 Then 'charlie if
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
ElseIf Range("g" & x - 1) < 2 Then
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
Else: ActiveCell.Value = "2 yellow"
End If

In the active cell, I am getting "=R[-1]C[-3]-RC[-3]" showing up instead of
the result. I've tried chaning formatting to general, text, number, etc.
Sometimes it works sometimes it doesn't. The last time I ran the macro, I
got a mix of success and failure with the cells formatted as text.
Any ideas why this is happening?
TIA
Papa J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Formula appearing instead of result

Hi,

The cells may be formatted as text so try this. Also note your code can be
simplified to this version

If Range("g" & x - 1) < 2 Then 'charlie if
With ActiveCell
.NumberFormat = "General"
.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
End With
Else
ActiveCell.Value = "2 yellow"
End If
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Papa Jonah" wrote:

I have the following code in a macro
If Range("g" & x - 1) 2 Then 'charlie if
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
ElseIf Range("g" & x - 1) < 2 Then
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
Else: ActiveCell.Value = "2 yellow"
End If

In the active cell, I am getting "=R[-1]C[-3]-RC[-3]" showing up instead of
the result. I've tried chaning formatting to general, text, number, etc.
Sometimes it works sometimes it doesn't. The last time I ran the macro, I
got a mix of success and failure with the cells formatted as text.
Any ideas why this is happening?
TIA
Papa J

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default Formula appearing instead of result

Thanks Mike!

"Mike H" wrote:

Hi,

The cells may be formatted as text so try this. Also note your code can be
simplified to this version

If Range("g" & x - 1) < 2 Then 'charlie if
With ActiveCell
.NumberFormat = "General"
.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
End With
Else
ActiveCell.Value = "2 yellow"
End If
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Papa Jonah" wrote:

I have the following code in a macro
If Range("g" & x - 1) 2 Then 'charlie if
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
ElseIf Range("g" & x - 1) < 2 Then
ActiveCell.FormulaR1C1 = "=R[-1]C[-3]-RC[-3]"
Else: ActiveCell.Value = "2 yellow"
End If

In the active cell, I am getting "=R[-1]C[-3]-RC[-3]" showing up instead of
the result. I've tried chaning formatting to general, text, number, etc.
Sometimes it works sometimes it doesn't. The last time I ran the macro, I
got a mix of success and failure with the cells formatted as text.
Any ideas why this is happening?
TIA
Papa J

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
Formula result does not match displayed result lothar Excel Worksheet Functions 1 June 23rd 08 05:05 AM
Formula Bar F9 Result differs from cell result??? Aaron Excel Worksheet Functions 3 May 15th 08 06:32 PM
Formula result not appearing in Cell Richard Excel Worksheet Functions 1 March 19th 07 10:48 PM
Advanced formula - Return result & Show Cell Reference of result Irv Excel Worksheet Functions 7 May 6th 06 03:36 AM
Why is my formula appearing in the cell not the value? smithers2002 Excel Worksheet Functions 3 October 6th 05 12:34 PM


All times are GMT +1. The time now is 05:38 PM.

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

About Us

"It's about Microsoft Excel"