Actually I need to physically add a line (not a blank row) between a group of
skus, see below, I need a line under AAA Rich, another line under BBB Scott.
SKU Customer
AAA Jack
AAA Scott
AAA Rich
BBB Scott
"squenson via OfficeKB.com" wrote:
Excel has no formula to format rows or columns, but a simple macro will do it.
Press Alt-F11 to open the macro editor, click on the sheet name on the left
pane and copy this code on the main pane. To run the macro, press ALT-F8 and
double-click on AddLineAfterEachSKU.
You must adapt two lines of codes to your needs. Obviously, it is expected
that your sheet is sorted by SKU and that there are no blank lines.
Sub AddLineAfterEachSKU()
Dim sColumn As String
Dim iFirstRow As Long
Dim i As Long
' CHANGE THE LINE BELOW
' AND PUT THE COLUMN NAME
' THAT CONTAINS THE SKU CODE
sColumn = "A"
' CHANGE THE LINE BELOW
' AND PUT THE ROW NUMBER
' THAT CONTAINS THE FIRST SKU CODE
' (THIS TO SKIP THE HEADER LINES)
iFirstRow = 2
i = iFirstRow + 1
While Cells(i, sColumn) < ""
If Cells(i - 1, sColumn) < Cells(i, sColumn) Then
Rows(i).Select
Selection.Insert Shift:=xlDown
i = i + 2
Else
i = i + 1
End If
Wend
End Sub
Stephane Quenson.
Holly wrote:
My file has over 1000 lines by sku & customr, I need to add line between each
sku group. This is a data file, I don't want to pivot table to add line,
instead of manually add line between each sku, does excel have a formular to
add line?
--
Message posted via http://www.officekb.com