Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FORMATTING UNDERLINES AND BORDERS
I have a spreadsheet of financial information. The line items which
are detail information have a "D" in column a and the subtotals and totals have a different character such as 3 for a subtotal ot "T" for a total. This macro inserts a blank line after each subtotal or total (anything not labeled as a "D"). How can I modify it so it will underline the border at either the last "D" record or place a line at the top of the cell for the first < "D" ( a line after "cost" in the simple example below) D Sales $100 D Cost $50 3 Margin $50 D more expenses $50 Sub InsertRow_A_Chg() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim irow As Long, vcurrent As String, i As Long '// find last used cell in Column A irow = Cells(Rows.Count, "A").End(xlUp).Row '// get value of that cell in Column A (column 1) vcurrent = Cells(irow, 1).Text '// rows are inserted by looping from bottom For i = irow To 2 Step -1 If Cells(i, 1).Text = "" Then vcurrent = Cells(i - 1, 1) ElseIf Cells(i, 1).Text < "D" Then vcurrent = Cells(i, 1).Text Rows(i + 1).Insert End If Next i Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
conditional formatting borders | Excel Discussion (Misc queries) | |||
Conditional Formatting Borders | Excel Discussion (Misc queries) | |||
Sometimes a cell will not allow formatting, like borders | Excel Discussion (Misc queries) | |||
Cell Formatting or Borders | Excel Discussion (Misc queries) | |||
Formatting Borders - Easy | Excel Discussion (Misc queries) |