LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default VBA Formula Errors

Make sure you get rid of the underscore in the code
Sandy wrote:
Try this:

Dim iter As Object
For Each iter In Range("Opportunities")
Debug.Print iter.Value
If iter.Value 0 Then
iter.Offset(0, 3).Value = "=P_Bar"
'This works, but I really want the VALUE, not the formula
Debug.Print iter.Offset(0, 3).Value, iter.Value

'Error at following statement
iter.Offset(0, 5).Value = _
((iter.Offset(0, 3).Value) * (1 - iter.Offset(0,
3).Value)) / _
(iter.Value ^ 0.5) 'Sigma calculation

iter.Offset(0, 2).Value = (iter.Offset(0, 3).Value - 3) * _
(iter.Offset(0, 5).Value) 'LCL

iter.Offset(0, 4).Value = (iter.Offset(0, 3).Value + 3) * _
(iter.Offset(0, 5).Value) 'UCL

' iter.Offset(0, 6).Value = _
' (iter.Offset(0, 1).Value - Range("P_Bar").Value) / _
' (iter.Offset(0, 5)) 'Zi calculation
Else
iter.Offset(0, 5).FormulaR1C1 = "=NA()" 'Sigma calculation
iter.Offset(0, 2).FormulaR1C1 = "=NA()" 'LCL Calculation
iter.Offset(0, 3).FormulaR1C1 = "=NA()" 'CL Calculation
iter.Offset(0, 4).FormulaR1C1 = "=NA()" 'UCL Calculation
iter.Offset(0, 6).FormulaR1C1 = "=NA()" 'Zi Calculation
End If
Next

Sandy


Barb Reinhardt wrote:
For Each Iter In Range("Opportunities")
Debug.Print Iter.Value
If Iter.Value 0 Then
Iter.Offset(0, 3).Value = "=P_Bar"
'This works, but I really want the VALUE, not the formula
Debug.Print Iter.Offset(0, 3).Value, Iter.Value

'Error at following statement
Iter.Offset(0, 5).Value = _
([ Iter.Offset(0,3).value * (1 - Iter.Offset(0,3).value)] /
Iter.Value) ^ (0.5) 'Sigma calculation
Iter.Offset(0, 2).Value = Iter.Offset(0, 3).Value - 3 *
Iter.Offset(0, 5).Value 'LCL
Iter.Offset(0, 4).Value = Iter.Offset(0, 3).Value + 3 *
Iter.Offset(0, 5).Value 'UCL
Iter.Offset(0, 6).Value = _
(Iter.Offset(0, 1).Value - Range("P_Bar").Value) /
Iter.Offset(0, 5) 'Zi calculation
Else
Iter.Offset(0, 5).FormulaR1C1 = "=NA()" 'Sigma calculation
Iter.Offset(0, 2).FormulaR1C1 = "=NA()" 'LCL Calculation
Iter.Offset(0, 3).FormulaR1C1 = "=NA()" 'CL Calculation
Iter.Offset(0, 4).FormulaR1C1 = "=NA()" 'UCL Calculation
Iter.Offset(0, 6).FormulaR1C1 = "=NA()" 'Zi Calculation

End If
Next

Can someone assist?

Thanks,
Barb


 
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
Formula Errors / #Value! Mary Lou[_2_] Excel Worksheet Functions 5 May 24th 08 12:51 AM
Mod a Formula For Errors carl Excel Worksheet Functions 1 August 22nd 07 09:42 PM
Formula errors MeSteve Excel Worksheet Functions 2 August 16th 06 11:42 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


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