Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[color #ff0000]Problems with IF.. .Then

Status
Not open for further replies.

mtroche

Civil/Environmental
Jun 4, 2001
39
0
0
PR
Below is the program tied to a userform in EXCEL. The userform is used to get the desired clearence below a powerline and the place from the lowest pole where the desired clearance will be calculated. The problem is that the span is 25 meters long and I can't calculate the clearance at the these places (from 3 to 9 meters from the lowest pole) because the following message comes:

"The Distance from the Lowest Pole where the Sag will be Calculated shall be Smaller than or Equal to " & Worksheets("TSag Net").range("e3"), _
vbInformation, "Check"

Of course I have checked the value in Worksheets("TSag Net").range("e3") and this is the correct one -- "25".

I have no idea why this is occuring... Any help will be very usefull. Thank you for the help you can give me.


Private Sub Calculate_Click()
TodoLlenoTension = 0

If IsNumeric(TensionSag) = False Then
MsgBox "Check the Desired Sag.", _
vbInformation, "Check"
ElseIf TensionSag < 0 Then
MsgBox &quot;The Sag Value shall be Positive.&quot;, _
vbInformation, &quot;Check&quot;
ElseIf TensionDistance <> &quot;At the Lowest Point&quot; And _
IsNumeric(TensionDistance) = False Then
MsgBox &quot;Check the Distance from the Lowest Pole where the Sag will be Calculated.&quot;, _
vbInformation, &quot;Check&quot;
ElseIf IsNumeric(TensionDistance) = True And TensionDistance < 0 Then
MsgBox &quot;The Distance from the Lowest Pole to the Sag shall be Positive.&quot;, _
vbInformation, &quot;Check&quot;
ElseIf IsNumeric(TensionDistance) = True And TensionDistance > Worksheets(&quot;TSag Net&quot;).range(&quot;e3&quot;) Then
MsgBox &quot;The Distance from the Lowest Pole where the Sag will be Calculated shall be Smaller than or Equal to &quot; & Worksheets(&quot;TSag Net&quot;).range(&quot;e3&quot;), _
vbInformation, &quot;Check&quot;

'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Else: TodoLlenoTension = 1
End If

If TodoLlenoTension = 1 Then

Me.Hide
StartTime = Timer

Worksheets(&quot;PoleData&quot;).Cells(2, 10) = TensionSag
Worksheets(&quot;(TSag)2&quot;).Activate


'XXXXXX COTEJA AQUI XXXXXX
If TensionDistance <> &quot;At the Lowest Point&quot; Then
Worksheets(&quot;(TSag)2&quot;).range(&quot;ap30&quot;) = TensionDistance * 3.28
Sheet6.Iterating_For_ClearanceB
Else
Worksheets(&quot;(TSag)2&quot;).range(&quot;ap30&quot;) = &quot;&quot;
Sheet6.Iterating_For_Clearance
End If


'XXXXXX COTEJA AQUÏ XXXXXX
EndTime = Timer
Worksheets(&quot;(TSag)2&quot;).range(&quot;ar30&quot;) = Format(EndTime - StartTime, &quot;0.0&quot;)
Tension.Caption = Worksheets(&quot;(TSag)2&quot;).range(&quot;x15&quot;) & &quot; Lbs&quot;
ElapsedTime.Caption = Worksheets(&quot;(TSag)2&quot;).range(&quot;ar30&quot;) & &quot; segs&quot;

UserFormTension.Show

End If
End Sub
 
Replies continue below

Recommended for you

mtroche,

I notice this is a second posting of this question, with no replies to your original post. I would be happy to take a look at this workbook if this is OK with you. If so, be sure the data producing the problem is in place, and send to me at rmikesmith@earthlink.net


Regards,
Mike
 
Hi, MSmith:

Thanks for requesting my posting, but I have already fixed the problem... It should be a &quot;bug&quot; in EXCEL. Everything is Bullet Proof until the gun fires!! :)
 
Status
Not open for further replies.
Back
Top