title: VBA range selection / clearing error
body: <p>I'm trying to clear a certain row on the columns A:H and K in my sheet using vba.
  In column K there's not only a value, also a checkbox.
  I'd like to leave column I en J as they are since there's a formula in those rows.</p>
  
  <p>Now I've tried a lot of different options found shattered on the internet, but can't seem to fix the problem.</p>
  
  <p>My code is as following:</p>
  
  <pre><code>Sub ClearSelected()
  
  Sheets("overview").Unprotect
  Sheets("Database").Unprotect
  
  Dim ws1 As Worksheet
  Dim ws2 As Worksheet
  Dim rng As Range
  Dim counter As Integer
  Dim vert As Integer
  Dim r As Range
  Dim chkbx As CheckBox
  
  Set ws1 = Worksheets("Overview")
  Set ws2 = Worksheets("Database")
  Set rng = ws1.Range("P2")
  
  vert = rng.Value + 1
  counter = 2
  
  'do Loop
  Worksheets("Database").Activate
  Do While counter &lt; vert
  
      'if "True", remove row
      If ws2.Range(ws2.Range("K" &amp; counter)) = True Then
          ws2.Range("A" &amp; counter &amp; ":H" &amp; counter).Select
          Selection.Clear
  
          ws2.Range("K" &amp; counter).Select
          Selection.Clear
  
  
          'Remove checkbox in selectie
          Set r = Selection
          For Each chkbx In ActiveSheet.CheckBoxes
              If Not Intersect(r, chkbx.TopLeftCell) Is Nothing Then chkbx.Delete
          Next chkbx
  
  
          rng.Value = rng.Value - 1
      'remove checkbox
      End If
   counter = counter + 1
  
   Loop
   Sheets("overview").Protect AllowUsingPivotGraphs:=True
  Sheets("Database").Protect
  
  End Sub
  </code></pre>
  
  <p>For some reason it's failing on the range selection/clearing.
  I'm getting the errormessage 1004.</p>
  
  <p>Hope you have a good suggestion for me.</p>