Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Apply a R1C1 function to a specific range

Hi!
I use the following function:
Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 = "=RC[-2]/RC[10]"
I would to modify the formula to apply it only when RC[-2] is greater than 0.
Thank you!
Alex
--
Alex St-Pierre
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Apply a R1C1 function to a specific range

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alex St-Pierre" wrote in message
...
Hi!
I use the following function:
Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 = "=RC[-2]/RC[10]"
I would to modify the formula to apply it only when RC[-2] is greater than
0.
Thank you!
Alex
--
Alex St-Pierre



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Apply a R1C1 function to a specific range

It works well but I'm wondering if there is way to put the condition inside
the selection of the Range. By this way, there will not have formula when not
needed.
Thank you!
Alex
--
Alex St-Pierre


"Bob Phillips" wrote:

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alex St-Pierre" wrote in message
...
Hi!
I use the following function:
Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 = "=RC[-2]/RC[10]"
I would to modify the formula to apply it only when RC[-2] is greater than
0.
Thank you!
Alex
--
Alex St-Pierre




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Apply a R1C1 function to a specific range

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"
Range(Cells(i, 13), Cells(i, 500)).Value = Range(Cells(i, 13), Cells(i,
500)).Value

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alex St-Pierre" wrote in message
...
It works well but I'm wondering if there is way to put the condition
inside
the selection of the Range. By this way, there will not have formula when
not
needed.
Thank you!
Alex
--
Alex St-Pierre


"Bob Phillips" wrote:

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Alex St-Pierre" wrote in
message
...
Hi!
I use the following function:
Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 = "=RC[-2]/RC[10]"
I would to modify the formula to apply it only when RC[-2] is greater
than
0.
Thank you!
Alex
--
Alex St-Pierre






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Apply a R1C1 function to a specific range

Hi Bob,
I would like to let the formulas in the cells when RC[-2] is greater than 0.
So, when RC[-2] is empty, I don't want to show a formula. The result of
RC[-2]/RC[10] = #DIV/0 when RC[-2] equal to 0.

Is it possible to reach the non empty cells of the column RC[-2] using
something like:
Set rng = wks2.Rows(1).Find(What:="SSN", LookAt:=xlWhole)
Then, I could offset the range to RC[2] and apply the formula on the
selected cells range only.
Or is there a SpecialCells function that allow the selection of non empty
cells only?
like: Selection.SpecialCells(xlCellTypeBlanks).Select
Thanks a lot!
Alex
--
Alex St-Pierre


"Bob Phillips" wrote:

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"
Range(Cells(i, 13), Cells(i, 500)).Value = Range(Cells(i, 13), Cells(i,
500)).Value

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alex St-Pierre" wrote in message
...
It works well but I'm wondering if there is way to put the condition
inside
the selection of the Range. By this way, there will not have formula when
not
needed.
Thank you!
Alex
--
Alex St-Pierre


"Bob Phillips" wrote:

Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 =
"=IF(RC[-2]0,RC[-2]/RC[10],"""")"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Alex St-Pierre" wrote in
message
...
Hi!
I use the following function:
Range(Cells(i, 13), Cells(i, 500)).FormulaR1C1 = "=RC[-2]/RC[10]"
I would to modify the formula to apply it only when RC[-2] is greater
than
0.
Thank you!
Alex
--
Alex St-Pierre






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
modify a macro to apply to a specific range of cells Dave F Excel Discussion (Misc queries) 2 April 25th 07 03:00 AM
Using Relative Reference Function to apply to Range Anthony[_14_] Excel Programming 2 December 14th 06 03:00 AM
How can I apply the ROUND function to a range of cells in a workbo Ellemarr Excel Discussion (Misc queries) 5 June 11th 05 01:09 AM
Displaying value of specific cell within a range, with IF function...? Steve Excel Discussion (Misc queries) 1 January 14th 05 02:23 AM
How to apply a function across a range of cells Paul Excel Programming 0 July 9th 03 10:42 PM


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