Home > Enterprise >  Getting a runtime error 1004 on close of app
Getting a runtime error 1004 on close of app

Time:10-23

I only get the runtime error when closing the file if my combobox has a value stored in it. If I never activate the combobox and close the app it doesn't error out. The error is on the Sheet5.Protect line.

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

CodePudding user response:

One possibility could be that the worksheet is protected at runtime, which would prevent the values ​​in those cells from being changed if they are locked. (subsequent calls). I don't know the purpose of protecting at that time. Check that everything editable is not protected and, if it is, unprotect it first. And the protect code is always best placed in Thisworkbooks Open event

  • Related