View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Conditional Calculation

Hi Matt,

Try:

'================
Sub TestIt()
Dim rng As Range, rng2 As Range
Dim rcell As Range
Dim aCell As Range
Dim LRow As Long
Dim rngPlanned As Range
Dim CalcMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

LRow = Cells(Rows.Count, "E").End(xlUp).Row

Set rng = Range("E2:E" & LRow) '<<==== CHANGE

For Each rcell In rng.Cells
With rcell
If LCase(.Value) = "planned pospects" _
Or LCase(.Value) = "unplanned prospects" Then
Set rng2 = .Offset(0, 15).Resize(1, 12)
rcell.Offset(0, 10).Copy
rng2.PasteSpecial Paste:=xlValues, _
Operation:=xlMultiply, _
SkipBlanks:=False, _
Transpose:=False
End If
End With
Next rcell

With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================



---
Regards,
Norman



"matpj" wrote in
message ...

Hi Norman,

the actuals start in column T and go until Column AE.
THe values should be replaced by a value equal to the existing value
mulitplied by the value in column O.

but ONLY on rows where column E contains either "Prospects" or
"Unplanned Prospects"

does that make sense?

the code basically needs to scan each row, and when it finds either
value in Column E, then perform the calculation...

thanks for any help,

Matt


--
matpj
------------------------------------------------------------------------
matpj's Profile:
http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=488678