View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default how to get excel to calculate from ASP?

After you put the values into the worksheet, use the following code:

Application.Calculate

.... to cause the recalculation engine to update all formulas before you
fetch the results. Normally, Excel waits until all macros have ended before
calling the recalculation engine.

Also, are you sure that your values are numbers, and not text values? You
can try the following routine to check. Simply select the range of cells
that are supposed to be numbers. It will stop and show each cell that is
not a number.

'----------------------------------------------------------------------
Public Sub CheckCells()
Dim rngCell As Range
Dim blnNonNumericFound As Boolean

For Each rngCell In Selection
If Not IsEmpty(rngCell) _
Then
If Not IsNumeric(rngCell) _
Then
blnNonNumericFound = True
With rngCell
.Activate
MsgBox "Cell " & .Address & " value is not a number!", _
vbInformation + vbOKOnly, _
"Check Cells"
End With
End If
End If
Next rngCell

If Not blnNonNumericFound _
Then
MsgBox "All cells in the selection were numbers.", _
vbInformation + vbOKOnly, _
"Check Cells"
End If
End Sub

--
Regards,
Bill Renaud