Copy If

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have data in cells A1..L1. I have a condition (A,B or C) in cells
H30..S30. Cell A1 corresponds to h30, B1 to I30, etc.

I need a routine that will copy and paste the data down 6 rows based up on
the condition. So for each cell in H30..S30 that has A in it, the routine
will then paste the value 6 rows down.

Any help is appreciated.

Regards
 
This may get you started. You can modify the range as needed.

Sub Copyif()
Dim MyRange As Range
Dim MyCell As Range
Set MyRange = Range("H30:S30")
For Each MyCell In MyRange
If MyCell.Value = "A" Then
MyCell.Copy Destination:=Range(MyCell.Address) _
.Offset(6, 0)
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top