If true, paste, then next cell

D

david.vantil

I am going around in circles trying to get this macro to work. I would
like it to see if the contents of a cell match a perameter. If so I
want it to paste a copied range of data into the cell, then check the
next cell until it either reached an empty cell.

Any suggestions?


Range("$AP$2:$DZ$2").Select
Selection.Copy

Dim rg1 As Range
Set rg1 = Range("AP12")

Do Until IsEmpty(rg1)
If rg1 = "2" Then
ActiveSheet.Paste
Else
Set rg1 = rg1.Offset(1, 0)

End If
Loop
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

Top