jeudi 20 avril 2017

Copy and paste range of cells with checkbox

My company has a sheet we are tracking special order items on. Occasionally, we will have an item returned, so the last column (L) on our special order sheet notes if the item was returned or not. I am wanting to use a checkbox in that column to copy and paste information from that row, to another sheet(returns) so that all that has to be input is specific return info.

This is what I have come up with. It will work with one cell, but not a range of cells.

Private Sub CheckBox4_Click()
  Dim SrcRange As Range
  Dim TrgRange As Range

  Set SrcRange = Worksheets("Special Orders").[A4:D4,H4:I4]
  Set TrgRange = Worksheets("Returns").[A4:D4,H4:I4]


  If CheckBox4 Then
    TrgRange = SrcRange
  Else
    TrgRange = ""
  End If
End Sub

Also, I would like as each box is clicked, the copied data is moved to the top of the table on "results," so I don't have a bunch of blanks between items checked.




Aucun commentaire:

Enregistrer un commentaire