while loop?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written the following code:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

Dim x As Integer

If Sheets("Summary").Range("K26") > 24 Then
MsgBox "YOU HAVE EXCEEDED 24 TON LIMIT"

x = Application.InputBox( _
prompt:="At what tonnage would you like to be warned
again?", Type:=2)
End If

If Sheets("Summary").Range("K26") > x Then
MsgBox "YOU HAVE EXCEEDED " & x & "TON LIMIT"

End If

End Sub

Basically, if cell K26 exceeds 24 tons, i wan tthe user to be prompt ONCE.
then asked for input on when he should be prompt again.

I want the second warning to come up, and give the user the option to ignore
warning or be reminded each time the tonnage is increased.

any ideas??
 
Hi steve,

This may be a silly question, but...

Why not overwrite the worksheet range with your new limit?

ie place the limit value in some convenient cell (like A1 = 24) and

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

Dim x As Single

x = Sheets("Summary").Range("A1").Value

If Sheets("Summary").Range("K26") > x Then
MsgBox "YOU HAVE EXCEEDED " & x & " TON LIMIT"

x = Application.InputBox( _
prompt:="At what tonnage would you like to be warned again?",
Type:=2)
If x <> 0 Then
Sheets("Summary").Range("A1") = x
End If
End If

End Sub

Ed Ferrero
http://www.edferrero.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top