在 Excel 中有宏,它使用 application.inputbox 在单元格中保存日期。输入日期后,格式正确的日期出现在单元格中,然后输入框再次打开。它似乎陷入了这个奇怪的循环。无论我输入多少次它再次询问的日期。
这是这段代码:
Function freshSTART()
redBOX.Cells(1).Value = Application.InputBox(prompt:="Enter todays date: ", Title:="TODAY'S DATE", Type:=1)
redBOX.Cells(2).Value = Application.InputBox(prompt:="Enter customer's name: ", Title:="CUSTOMER NAME", Type:=2)
redBOX.Cells(3).Value = Application.InputBox(prompt:="Enter travel out date: ", Title:="TRAVEL OUT DATE", Type:=1)
redBOX.Cells(4).Value = Application.InputBox(prompt:="Enter travel back date: ", Title:="TRAVEL BACK DATE", Type:=1)
redBOX.Cells(5).Value = Application.InputBox(prompt:="Enter number of technicians: ", Title:="TECHNICIANS", Type:=1)
redBOX.Cells(6).Value = Application.InputBox(prompt:="Enter number of engineers: ", Title:="ENGINEERS", Type:=1)
redBOX.Cells(7).Value = Application.InputBox(prompt:="Enter location: ", Title:="LOCATION", Type:=2)
End Function