Macro to add first row (titles) at every cchange in column P (Invoice Number) He
ID: 3564725 • Letter: M
Question
Macro to add first row (titles) at every cchange in column P (Invoice Number)
Helloo,,,
I need help writing a macro to add the first row, which are titles, at every change of column P, which are invoice numbers. I basically need to separate all invoices by inserting the titles in between without any spaces.
This is what I have:
This is what I need:
Thanks so much!
Macro to add first row (titles) at every cchange in column P (Invoice Number) Helloo,,, I need help writing a macro to add the first row, which are titles, at every change of column P, which are invoice numbers. I basically need to separate all invoices by inserting the titles in between without any spaces. This is what I have: This is what I have: Thanks so much!Explanation / Answer
Hi,
Try this code.
Sub insertrowifnammechg()
Dim X As Long
For X = Cells(Rows.Count, "P").End(xlUp).Roow To 3 Step -1
If Cells(X - 1, "P") <> Cells(X, "P") Then
Rows(X).Insert
Cells(1, 1).EntireRow.Copy Cells(X, 1)
End If
Next X
End Subbb!!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.