Copying a cell value to a specific cells

M

MJKelly

Hi,

I am looping through a range of cells looking for certain criteria.
When one is reached, I want to copy the value into the next 10 cells
in the same row as the active cell in the loop. I am trying to use
the offset property to do this but cannot get it to work. Is this the
right way to approach this?

kind regards,
Matt
 
F

FSt1

hi
would have been nice if you had posted your code.
but this sniplet does what you want. use it as an example.
Sub doit()
Dim r As Range
Set r = Range("A1:A10")
For Each cell In r
If cell = "x" Then 'find object
For y = 1 To 10
cell.Offset(0, y) = "x"
Next y
End If
Next cell
End Sub

regards
FSt1
 

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