Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default A formula that evaluates the value of a cell relatively addressed.

Never posted before...
If you please....
I have the following working formula in cell H69 (for example):

=IF(D69=0,"","Limit")
When D69 equals zero, H69 is blank, otherwise it shows the string
"Limit".

A macro will assign this formula to a particular cell and it won't
always be row 69. How can I replace the D69 with something akin to
"current column minus 4" & "current row"?

The VBA is
ActiveCell = <the formula above

Thanks for any ideas!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default A formula that evaluates the value of a cell relatively addressed.

Sub test2()
Dim sFmla As String

sFmla = "=IF(RC[-4]=0,"""",""Limit"")"

ActiveCell = sFmla
' or
ActiveCell.Formula = sFmla
' or
ActiveCell.FormulaR1C1 = sFmla

'no need to use activecell, eg
Range("E1:E5").Formula = sFmla

End Sub

Regards,
Peter T

"NorMacro" wrote in message
oups.com...
Never posted before...
If you please....
I have the following working formula in cell H69 (for example):

=IF(D69=0,"","Limit")
When D69 equals zero, H69 is blank, otherwise it shows the string
"Limit".

A macro will assign this formula to a particular cell and it won't
always be row 69. How can I replace the D69 with something akin to
"current column minus 4" & "current row"?

The VBA is
ActiveCell = <the formula above

Thanks for any ideas!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default A formula that evaluates the value of a cell relatively addressed.

One way:

ActiveCell.FormulaR1C1 = "=IF(R[]C[-4]=0,"""",""Limit"")"

In article .com,
NorMacro wrote:

Never posted before...
If you please....
I have the following working formula in cell H69 (for example):

=IF(D69=0,"","Limit")
When D69 equals zero, H69 is blank, otherwise it shows the string
"Limit".

A macro will assign this formula to a particular cell and it won't
always be row 69. How can I replace the D69 with something akin to
"current column minus 4" & "current row"?

The VBA is
ActiveCell = <the formula above

Thanks for any ideas!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default A formula that evaluates the value of a cell relatively addressed.

Thank you. Your adjustment to my formula along with your method(s)
worked smoothly.

I want to point out though that, as you went about it, the macro
evaluates the IF statement and assigns either blank or "Limit" to the
cell. I would sure like to have a formula in the target cell, such
that it can continue to evaluate the conditions in the cell four
columns left and continue to display either blank or "Limit".

If you have the patience with me...thanks in advance!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default A formula that evaluates the value of a cell relatively addres

Did you look in the formula bar for the cells you ran the macro on?
It looks to me like the macro put the formula in the cell and it will
continue to evaluate and execute the result.

"NorMacro" wrote:

Thank you. Your adjustment to my formula along with your method(s)
worked smoothly.

I want to point out though that, as you went about it, the macro
evaluates the IF statement and assigns either blank or "Limit" to the
cell. I would sure like to have a formula in the target cell, such
that it can continue to evaluate the conditions in the cell four
columns left and continue to display either blank or "Limit".

If you have the patience with me...thanks in advance!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default A formula that evaluates the value of a cell relatively addres

Peter, JE, JL,

I just found that I had not in fact removed an old line of macro code
that I believed I had removed. It now works perfectly! Thanks for
your time!


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
How a cell can be addressed with variable file-column? thegreeneyes Excel Discussion (Misc queries) 1 February 5th 08 02:33 PM
Please help - formula works in some cells but evaluates to #value in others Ullie Excel Worksheet Functions 2 June 14th 06 08:16 PM
questions being addressed Luke Excel Worksheet Functions 9 November 11th 05 07:21 PM
Simplifying array formula which evaluates as error. Richard Buttrey Excel Worksheet Functions 5 September 30th 05 02:35 AM
Can I create a formula in Excel that evaluates form information? SallyP Excel Worksheet Functions 4 June 14th 05 06:40 PM


All times are GMT +1. The time now is 05:44 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"