Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional formatting borders PhilosophersSage Excel Discussion (Misc queries) 9 October 2nd 09 05:47 PM
Conditional Formatting Borders AJ Excel Discussion (Misc queries) 2 January 29th 09 05:53 PM
Sometimes a cell will not allow formatting, like borders tom1 Excel Discussion (Misc queries) 0 February 3rd 06 07:33 PM
Cell Formatting or Borders Ryan D Excel Discussion (Misc queries) 7 March 14th 05 06:29 PM
Formatting Borders - Easy FuadsCurse Excel Discussion (Misc queries) 5 December 23rd 04 03:21 AM


All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"