![]() |
while loop?
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?? |
while loop?
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 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?? |
All times are GMT +1. The time now is 05:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com