关闭应用程序时获取运行时错误1004



只有当我的组合框中存储了值时,我才会在关闭文件时收到运行时错误。如果我从未激活组合框并关闭应用程序,它不会出错。错误出现在Sheet5.Protect行上。

Private Sub ComboBox1_Change()
Sheet5.Protect Password:="groomingusa", UserInterfaceOnly:=True

myVarible = ComboBox1.Value

Call PriceAvg
Call PriceLow
Call PriceHigh
Call PriceBlade
Call PriceShrtComb
Call PriceMedComb
Call PriceLngComb

End Sub

一种可能是工作表在运行时受到保护,这将阻止值​​如果这些细胞被锁定,它们就不会被改变。(后续调用(。我当时不知道保护的目的。检查所有可编辑内容是否未受保护,如果是,请先取消保护。保护代码总是最好放在Thisworkbooks Open event 中

最新更新