I'm in need of help to automate sorting data. I need the code to compare #s down columns "K" and "P", starting at the row the cursor currently is and ending at 1st blank cell in "K". I've recorded a Macro and added comments on what I'm trying to do and added below... Thanks for any help you can provide to automate this task I've been doing manually!
VBA Code:
Sub Shift_Rows()
'
' Shift_Rows Macro
'
'Compare columns "K" & "P" searching for unequal numbers starting at current curser location row
'Row("12:12") is 1st row where column "K" and "P" don't equal
'Insert Row at row 12:12
Rows("12:12").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
'Copy/Paste "M" through "S" on previous row down to "M12"
Range("M11:S11").Select
Selection.Copy
Range("M12").Select
ActiveSheet.Paste
'Select data down "K" starting at next row (K13) down to 1st blank cell and shift those cell up one cell
'The 1st blank cell here is at (K45)
Range("K13:K45").Select
ActiveWindow.SmallScroll Down:=-12
Application.CutCopyMode = False
Selection.Cut Destination:=Range("K12:K44")
'Copy new number in "K12" and paste in "P12"
'Continue to next row repeating process until the 1st blank cell in "K"
Range("K12").Select
Selection.Copy
Range("P12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub