I'm trying to write a macro that will use an if statement to copy data from one place to another.
Esentially:
If Range.Cells(i, j).Value = "Hello" Then Copy the three cells to the right of the word "Hello"
I think i might have to use an Offset? Which I'm not very experienced with, any help would be greatly appreciated! Thank you!
Edit:
This is what I have for my code:
For i = 1 To danesRange.Rows.Count
For j = 1 To danesRange.Columns.Count
If danesRange.Cells(i, j).Value = "Ins" Then
danesRangevalues.Cells(i, j).Copy
End If
Next j
Next i
I know how to copy and paste using VBA but I don't know how to copy and paste an unknown range because I don't know exactly where the range of those three cells will be, it depends on where the value "INS" falls. What I have so far will only copy the adjacent cell, not all three.
danesRange.Cells(i,j+3) = danesRange.Cells(i,j).Value
or something like that. Or string them together if there are multiple cells. A solid example would be helpful. - Liss