在Excel中有使用application.inputbox將單元格中的日期保存的宏。輸入日期後,格式正確的日期出現在單元格中,然後輸入框再次打開。它似乎陷入了這個怪異的循環。無論我輸入多少次,它都會再次提問。Excel輸入框在輸入後重新打開
下面是這部分代碼:
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
如何被觸發這個功能呢? (爲什麼不使用Sub,因爲這個代碼不會返回任何值?) –