Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default If cell value = x or y then perform formula set else skip

I have a sheet I am trying to add a formula to a different column if
the value in column 1 is either FAO or FVA. Then I have a subset of
formula to add...if it does not meet this criteria..then it needs to
skip it. It needs to continue to run thru the rows until Col 1 is
blank. The calculation formula works fine...just not at the
appropriate time (hence my request for help)

So in plain language I would like for this to happen

Check column 1 if value = FVA or FAO then

Range("M2").Select
ActiveCell.FormulaR1C1 = "=RC[-7]*0.084"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-8]:RC[-1])"
Range("O2").Select
ActiveCell.FormulaR1C1 = "=RC[-10]-RC[-1]"
'Range("M2:O2").Select

If value = anything else then skip
Continue until column 1 = blank

Any help would be greatly appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default If cell value = x or y then perform formula set else skip

This should be close...

Sub test()
Dim rng As Range
Dim rngToSearch As Range

With Sheets("Sheet1")
Set rngToSearch = .Range(.Range("A2"), _
.Cells(Rows.Count, "A").End(xlUp))
End With

For Each rng In rngToSearch
With rng
If .Value = "FVA" Or .Value = "FAO" Then
Cells(.Row, "M").FormulaR1C1 = "=RC[-7]*0.084"
Cells(.Row, "N").FormulaR1C1 = "=SUM(RC[-8]:RC[-1])"
Cells(.Row, "O").FormulaR1C1 = "=RC[-10]-RC[-1]"
End If
End With
Next rng
End Sub
--
HTH...

Jim Thomlinson


"JenIT" wrote:

I have a sheet I am trying to add a formula to a different column if
the value in column 1 is either FAO or FVA. Then I have a subset of
formula to add...if it does not meet this criteria..then it needs to
skip it. It needs to continue to run thru the rows until Col 1 is
blank. The calculation formula works fine...just not at the
appropriate time (hence my request for help)

So in plain language I would like for this to happen

Check column 1 if value = FVA or FAO then

Range("M2").Select
ActiveCell.FormulaR1C1 = "=RC[-7]*0.084"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-8]:RC[-1])"
Range("O2").Select
ActiveCell.FormulaR1C1 = "=RC[-10]-RC[-1]"
'Range("M2:O2").Select

If value = anything else then skip
Continue until column 1 = blank

Any help would be greatly appreciated

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default If cell value = x or y then perform formula set else skip

The day was crazy and I have not had a chance to give it a try. It
looks like I was just missing a couple of things. I will try on
Monday and let you know. Thanks for the help.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default If cell value = x or y then perform formula set else skip

This works great!!! Thank you for your help!!!

Consider the question closed
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
Looking for a formula to perform this additions Ayo Excel Discussion (Misc queries) 8 July 14th 09 07:21 PM
How do I perform a different formula on the same cell range? erinlm Excel Worksheet Functions 2 April 9th 08 10:04 PM
In Excel, how do I set a formula to skip a cell if zero? hlpme Excel Discussion (Misc queries) 3 December 3rd 07 10:08 PM
What function does ^ perform in a formula Mickford Excel Worksheet Functions 1 October 15th 07 06:25 PM
Reference a Macro to perform Cell formula Fred Djinn Holstings Excel Discussion (Misc queries) 1 February 2nd 07 03:50 AM


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