Consulting

Results 1 to 4 of 4

Thread: Application Defined or object Defined Error 1004 after every cell update

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Feb 2017
    Posts
    2
    Location

    Application Defined or object Defined Error 1004 after every cell update

    So I have some code that seems to giving me an error after everytime its exports data to a protected sheet. It appears after it exports to a cell; it will will lock up the sheet afterwards because when I call "unlocker" module above the export it runs. I don't not want to have to put this above every change as my full code is pretty long (and I'd like to know why this is happening). I have similar code on a bunch of other workbooks and no issues. Any Ideas?



    Module:

    Public Sub locker()
    Sheets("Sheet1").Protect "Password"
    ActiveWorkbook.Protect "Password"
    End Sub

    Code Example:

    Private Sub save4later_Click()
    
    Call unlocker
    If locationtype.Value = "Option 1" Then
    Sheets("Sheet1").Range("R3") = "Street Address 1"
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("R4") = "City Address 1"
    
    
    Else
    Sheets("Sheet1").Range("R3") = "Street Address 2"
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("R4") = "City Address 2"
    
    
    End If
    
    
    
    'Export of Data
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("E8").Value = Property.Text
    'unprotected sheet error does not occcur
    
    Sheets("Lists").Range("A15").Value = MeterID.Text 
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("k16").Value = Question1.Text
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("Q30").Value = sepques.Text
    'error will occur here unless call unlocker right above
    Sheets("Sheet1").Range("G51").Value = TestFlow.Text
    
    
    Call locker
    Me.hide
    
    End Sub

    Thanks
    Last edited by Paul_Hossler; 02-08-2017 at 10:29 AM. Reason: Added [CODE] tags - please use the [#] to add [CODE] [/CODE] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •