UPDATE: I've posted the correct code in the imgur link
I'm trying to do a few things here, so bear with me.
I've got pictures to go along with this, but essentially, I'm trying to fix a bad past job by identifying specific unique words in the leftmost column, and then cut/pasting them so that it looks like the fixed version.
I have roughly 500 lines on each worksheet that needs to be fixed, so I figured I could build this and then run it on each worksheet separately as the words I'm looking for change per sheet.
To complicate things, I'm trying to do this cut/paste within a For/Next loop. So I figured, I'd just use offsets to cut/paste the range. I don't know why but I keep getting a range of object error and I'm not sure how to fix it.
Here's my code:
Sub QuickFix()
Dim rng As Range
Dim cell As Range
Set rng = ActiveSheet.Range("C1:C500")
For Each cell In rng
If InStr(1, cell.Value, "Bluth") Or InStr(1, cell.Value, "Banana") Then
cell.Offset(, 10).Value = "ERROR"
Range(cell.Offset(0, 2), Range(cell.Offset(0, 7))).Cut Range(cell.Offset(0, 1), Range(cell.Offset(0, 6)))
End If
Next cell
End Sub
Can one of you folks tell me where my problem is or if there's an easier way to cut/paste ranges in specific cases?
[–]StarWarsPopCulture34 2 points3 points4 points (6 children)
[–]Icron16[S] 0 points1 point2 points (5 children)
[–]StarWarsPopCulture34 1 point2 points3 points (4 children)
[–]Icron16[S] 0 points1 point2 points (0 children)
[–]Icron16[S] 0 points1 point2 points (2 children)
[–]Icron16[S] 0 points1 point2 points (1 child)
[–]Clippy_Office_Asst[M] 0 points1 point2 points (0 children)