Saladsamurai
09-03-2009, 09:13 AM
I am using the following code to output to WorkSheets("Data Analysis")
The line in Bold is giving me problems. When it outputs the number to Cell(20,7) it is not obeying the Number Format that is assigned to that cell.
It's weird beause the line preceding the one in bold is nearly identical and it works fine.
Sub Temperature()
For i = 1 To nRow
For j = 1 To nCol
If T_CFD.Cells(i, j) <> "" And T_CFD.Cells(i, j) <> "$" Then
MyError_T = T_CFD.Cells(i, j) - T_ISX.Cells(i, j)
If Abs(MyError_T) > MyMax_T Then
MyMax_T = Abs(MyError_T)
End If
MyError_T = Abs(MyError_T)
Select Case MyError_T
Case Is <= 5
Within5 = Within5 + 1
Case Is < 10
Within5_10 = Within5_10 + 1
Case Is >= 10
Over10 = Over10 + 1
End Select
ErrorSquare_T = ErrorSquare_T + MyError_T ^ 2
End If
Next j
Next i
TotalObjects = Within5 + Within5_10 + Over10
' *************************************************************************** *****
' *************************************************************************** *****
DataAnalysis.Cells(19, 7) = MyMax_T & " " & Chr(176)
[B]DataAnalysis.Cells(20, 7) = (ErrorSquare_T / TotalObjects) ^ 0.5 & " " & Chr(176)
DataAnalysis.Cells(22, 7) = Within5 / TotalObjects
DataAnalysis.Cells(23, 7) = Within5_10 / TotalObjects
DataAnalysis.Cells(24, 7) = Over10 / TotalObjects
End Sub
The line in question produces:
3.85198375987113 °
The line in Bold is giving me problems. When it outputs the number to Cell(20,7) it is not obeying the Number Format that is assigned to that cell.
It's weird beause the line preceding the one in bold is nearly identical and it works fine.
Sub Temperature()
For i = 1 To nRow
For j = 1 To nCol
If T_CFD.Cells(i, j) <> "" And T_CFD.Cells(i, j) <> "$" Then
MyError_T = T_CFD.Cells(i, j) - T_ISX.Cells(i, j)
If Abs(MyError_T) > MyMax_T Then
MyMax_T = Abs(MyError_T)
End If
MyError_T = Abs(MyError_T)
Select Case MyError_T
Case Is <= 5
Within5 = Within5 + 1
Case Is < 10
Within5_10 = Within5_10 + 1
Case Is >= 10
Over10 = Over10 + 1
End Select
ErrorSquare_T = ErrorSquare_T + MyError_T ^ 2
End If
Next j
Next i
TotalObjects = Within5 + Within5_10 + Over10
' *************************************************************************** *****
' *************************************************************************** *****
DataAnalysis.Cells(19, 7) = MyMax_T & " " & Chr(176)
[B]DataAnalysis.Cells(20, 7) = (ErrorSquare_T / TotalObjects) ^ 0.5 & " " & Chr(176)
DataAnalysis.Cells(22, 7) = Within5 / TotalObjects
DataAnalysis.Cells(23, 7) = Within5_10 / TotalObjects
DataAnalysis.Cells(24, 7) = Over10 / TotalObjects
End Sub
The line in question produces:
3.85198375987113 °