Creating New PO#s in a Table

sande33

New Member
Joined
May 28, 2015
Messages
1
I'm taking over a spreadsheet made by someone else. The person is not contactable for assistance. I have a table that spans from A4:W514 and is called "CheckbookTable". I need a macro to create a new line in the table, but each new line needs to have a new and unique PO# in column L as well as copying the format from the above cell. I fount this macro online:

Sub Insert_New_Rows()
Dim Lr As Integer
Lr = Range("A" & Rows.Count).End(xlUp).Row 'Searching last row in column A
Rows(Lr + 1).Insert Shift:=xlDown 'Inserting new row
Cells(Lr + 1, "L") = Cells(Lr, "L") + 1 'Adding a sequential number
Rows(Lr).Copy 'Copying format of last row
Rows(Lr + 1).PasteSpecial Paste:=xlPasteFormats 'Pasting format to new row
Application.CutCopyMode = False 'Deactivating copy mode
End Sub



Problem is my associates and I will be filtering and sorting this table all kinds of ways and if the sort is not by PO# I will add 1 to the wrong PO# resulting in duplicate PO#s.

I would ideally like to have the macro use a count function to count the cell rows in the table and then add 15453750100 to the number (15 for 2015, 45375 - our unit, 0101 because that's where the other person started the counting).

Any ideas?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top