jeudi 8 septembre 2016

Copy row and paste bellow when cell value found in a collumn

I have pretty limited knowledge of VBA so hopefully i can explain what i'm trying to do! I'm trying to copy a row if it has anything > 0 in column J. I then want to insert this copied row into a new row bellow that copied cell. I would like this to loop through the whole worksheet so that every row with a value in J is repeated, the data in the worksheet varies in size.

Here's my failed attempt to far..

 Sub Copy_Cells()

    For Each objcell In ActiveSheet.Columns(10).Cells
     If objcell.Value > 0 Then
        Objecell.EntireRow.Select
        Selection.Copy
        Selection.Insert Shift:=xlDown
         Exit Sub
      End If
   Next objcell
 End Sub

Aucun commentaire:

Enregistrer un commentaire