Move data to right with variable rows

H

Hondavtx

I have a large spreadsheet with corrupted data. I can identify several types
of bad data and have correct the data in these rows but one particluar type
is giving me problems.

Because the spreadsheet is large I used filtering and visible cell commands
to correct blocks of data. This seems to work fine but one type is still not
working so I am trying a row by row logic search. In this case the bad data
needs to move from cell column B to C with the range through L. So any data
in the range B through L in the selected row is copied if the contents of L
="N". A cell is inserted at B and the data shifted to the right by one cell.
The rows is a variable. and I have a header at the top to ignore.

My Code at the moment looks like this

With ActiveSheet
Dim pointer As Long
For pointer = .UsedRange.Rows.Count To 2 Step -1
If .Cells(pointer, "L") = "N" Then
Range("B" & pointer).Select
Selection.Insert Shift:=xlToRight, _
CopyOrgin:=xlFormatFromLeftOrAbove
End If
Next
End With

This does not work and will also be slow. Any Suggestions?
 

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