I'm very new to VBA on Excel and I have a problem that's stumped me for a while now. In my Excel sheet (in the same row), I have Columns B and F where: if B is a higher value than F then insert a row beneath the current row and cut/paste the three columns of that row into the newly created row (see image link: https://i.stack.imgur.com/cRZbY.png) so B11:D11 would become B12:D12 and above those cells would be three blank cells. I have tried the below code for this but I keep getting an error 1004: PasteSpecial method of Range class failed. I suspect it has something to do with the PasteSpecial but it has worked for me previously.
Sub SubA()
Range("B11").Activate
If Range("B11").Value > Range("F11").Value Then ActiveCell.Offset(1).EntireRow.Insert Shift:=xlDown
Range(Selection, Selection.End(xlToRight)).Cut
ActiveCell.Offset(1).PasteSpecial Paste:=xlPasteValues
End Sub
If I can get this fixed for the first row, I would like it to do the same process for all rows in the spreadsheet, however I am not sure on how to start this either. Any help would be much appreciated! Thanks.
EDIT: The end result should look like this: https://i.stack.imgur.com/SXqg9.png There was a few more bits of code I was going to do after the above loop was sorted to get it to look like the above. Essentially, any unique weld numbers should have their own row, and any matching weld numbers should be in the same row (in ascending order).