I have a sheet full of data copied from a table. I have a macro running that is adding a blank row if certain criteria is met. However, instead of a whole row being inserted, only a cell is inserted. How can I get it to insert a row?
Column A Column B Column C Column D Column E Column F Column G
1234555 1234566 1234577 1234588 1234599 1234500 1234655
2234555 2234566 2234577 2234588 2234599 BLANK 2234655
3234555 3234566 3234577 3234588 3234599 2234500 3234655
This is what it is doing. Inserting a blank cell, then pushing that value below. I want it to do this:
Column A Column B Column C Column D Column E Column F Column G
1234555 1234566 1234577 1234588 1234599 1234500 1234655
BLANK ROW INSERTED HERE
2234555 2234566 2234577 2234588 2234599 2234500 2234655
3234555 3234566 3234577 3234588 3234599 3234500 3234655
Is there a way to do this? My code that is inserting a blank cell is below:
Thank you!!
Column A Column B Column C Column D Column E Column F Column G
1234555 1234566 1234577 1234588 1234599 1234500 1234655
2234555 2234566 2234577 2234588 2234599 BLANK 2234655
3234555 3234566 3234577 3234588 3234599 2234500 3234655
This is what it is doing. Inserting a blank cell, then pushing that value below. I want it to do this:
Column A Column B Column C Column D Column E Column F Column G
1234555 1234566 1234577 1234588 1234599 1234500 1234655
BLANK ROW INSERTED HERE
2234555 2234566 2234577 2234588 2234599 2234500 2234655
3234555 3234566 3234577 3234588 3234599 3234500 3234655
Is there a way to do this? My code that is inserting a blank cell is below:
Code:
Do
Sheets("P").Select
PValue = ActiveCell.Value
Sheets("C").Select
CValue = ActiveCell.Value
If PValue <> CValue Then
If PValue > CValue Then
Sheets("P").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
If CValue > PValue Then
Sheets("C").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
If IsEmpty(PValue) And IsEmpty(CValue) Then
Exit Sub
End If
End If
Sheets("P").Select
ActiveCell.Offset(1, 0).Select
Sheets("C").Select
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell)
Thank you!!