Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default formula calculation when cells are changed

Hi,
I am trying to perform a calculation based on Range b2 in a workbook.
However, I want the user to be able to change this cell and not have
to rerun the macro again.
I have an if...then statement that evaluates less than 60 and greater
than 30, then it evaluates less than 30, etc.

Is there a way I can do this?

Here is my code:(with help from a very nice person!)

With ActiveSheet
For iRow = 2 To lngRow
If InStr(1, .Cells(iRow, 2).Value, "appw1d",
vbTextCompare) Then
If LCase(.Cells(iRow, 1).Value) = LCase(" Target
Renewal") Then
For iCol = 6 To 20
If Range("$b$2") + .Cells(iRow - 1, iCol).Value + .Cells(iRow - 1,
iCol + 1).Value < 60 _
And .Cells("$B$2") + .Cells(iRow - 1, iCol).Value + .Cells(iRow -
1, iCol + 1).Value 30 Then
.Cells(iRow, iCol + 1).Formula =
"=VLOOKUP(""appw1d"",$f$1:$g$16,2,FALSE)*(1-$b$2-30)/30"
ElseIf .Cells(2, 2).Value + .Cells(iRow - 1, iCol).Value < 30 Then
.Cells(iRow, iCol).Formula =
"=VLOOKUP(""appw1d"",$f$1:$g$16,2,FALSE)*(1-$b$2/30)"
Else
..Cells(iRow, iCol).Formula = "=VLOOKUP(""appw1d"",$f$1:$g$16,2,FALSE)"
Next iCol
End If
End If
Next iRow
End With

Thanks for your help!
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
Excel Formula Calculation to add some cells lt Excel Discussion (Misc queries) 1 May 23rd 07 12:37 AM
the calculation tab being changed and you didn't change it? Sandra M. Excel Discussion (Misc queries) 4 January 20th 07 02:21 AM
keep specific cells from being changed. bronsonbits Excel Discussion (Misc queries) 1 September 7th 05 06:44 PM
My Calculation Mode Changed to Manual Somehow?!? Jeb Excel Discussion (Misc queries) 2 August 4th 05 03:40 PM
Save only new or changed cells JR[_4_] Excel Programming 1 December 15th 03 05:14 PM


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