![]() |
Loop has goofy message all of a sudden
I have the routine below in many spreadsheets and it has worked for a
long time up until now. When I run this macro now, I get a message as follows: "Code execution has been interrupted" and the options are Continue, end, or debug. Pushing continue makes it continue until it encounters the next Do While portion. What gives? I've never had this before with the "Continue" option. If I choose debug, it highlights the Loop While lines. Sub Date_Prompt() Do prmo = Application.InputBox("Enter Production Month" & _ " Between 1 and 12 Inclusive)", Type:=1) Loop While prmo < 1 Or prmo 12 Do pryr = Application.InputBox("Enter Production Year" & _ "Between 2000 and 2021 Inclusive)", Type:=1) Loop While pryr < 2000 Or pryr 2021 Range("prmo").Value = prmo Range("pryr").Value = pryr End Sub |
Loop has goofy message all of a sudden
On Jan 3, 2:31*pm, Revenue wrote:
I have the routine below in many spreadsheets and it has worked for a long time up until now. When I run this macro now, I get a message as follows: "Code execution has been interrupted" and the options are Continue, end, or debug. Pushing continue *makes it continue until it encounters the next Do While portion. What gives? I've never had this before with the "Continue" option. If I choose debug, it highlights the Loop While lines. Sub Date_Prompt() Do prmo = Application.InputBox("Enter Production Month" & _ * " Between 1 and 12 Inclusive)", Type:=1) Loop While prmo < 1 Or prmo 12 Do pryr = Application.InputBox("Enter Production Year" & _ * "Between 2000 and 2021 Inclusive)", Type:=1) Loop While pryr < 2000 Or pryr 2021 Range("prmo").Value = prmo Range("pryr").Value = pryr End Sub What are you trying to do? |
Loop has goofy message all of a sudden
On Jan 3, 6:53*pm, Don Guillett wrote:
On Jan 3, 2:31*pm, Revenue wrote: I have the routine below in many spreadsheets and it has worked for a long time up until now. When I run this macro now, I get a message as follows: "Code execution has been interrupted" and the options are Continue, end, or debug. Pushing continue *makes it continue until it encounters the next Do While portion. What gives? I've never had this before with the "Continue" option. If I choose debug, it highlights the Loop While lines. Sub Date_Prompt() Do prmo = Application.InputBox("Enter Production Month" & _ * " Between 1 and 12 Inclusive)", Type:=1) Loop While prmo < 1 Or prmo 12 Do pryr = Application.InputBox("Enter Production Year" & _ * "Between 2000 and 2021 Inclusive)", Type:=1) Loop While pryr < 2000 Or pryr 2021 Range("prmo").Value = prmo Range("pryr").Value = pryr End Sub What are you trying to do? This macro should be asking for two variables as it has in the past. One is a digit for the month, and obviously must be between 1 and 12. Then, the next part validates the year as being within a range as shown above to be between 2000 and 2021. |
Loop has goofy message all of a sudden
On Jan 3, 6:53*pm, Don Guillett wrote:
On Jan 3, 2:31*pm, Revenue wrote: I have the routine below in many spreadsheets and it has worked for a long time up until now. When I run this macro now, I get a message as follows: "Code execution has been interrupted" and the options are Continue, end, or debug. Pushing continue *makes it continue until it encounters the next Do While portion. What gives? I've never had this before with the "Continue" option. If I choose debug, it highlights the Loop While lines. Sub Date_Prompt() Do prmo = Application.InputBox("Enter Production Month" & _ * " Between 1 and 12 Inclusive)", Type:=1) Loop While prmo < 1 Or prmo 12 Do pryr = Application.InputBox("Enter Production Year" & _ * "Between 2000 and 2021 Inclusive)", Type:=1) Loop While pryr < 2000 Or pryr 2021 Range("prmo").Value = prmo Range("pryr").Value = pryr End Sub What are you trying to do?- Hide quoted text - - Show quoted text - Now the silly thing is working properly today. Who knows sometimes what these machines are trying to do? |
All times are GMT +1. The time now is 02:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com