Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default report - separator lines

I have a list of cities with offices. I want a line to indicate a new city.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default report - separator lines

Give this macro a try...

Sub LineAtCityChange()
Dim X As Long
Dim LastRow As Long
Const DataStartRow As Long = 2
Const CityColumn As String = "A"
Const TotalColumns = 3
With Worksheets("Sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Columns(CityColumn).Resize(, TotalColumns).Borders. _
LineStyle = xlLineStyleNone
For X = DataStartRow To LastRow
If Cells(X, CityColumn).Value < Cells(X + 1, CityColumn).Value Then
Cells(X, CityColumn).Resize(, TotalColumns). _
Borders(xlEdgeBottom). _
LineStyle = xlContinuous
End If
Next
End With
End Sub

You will have to change the worksheet reference in the With statement from
"Sheet2" to your own sheet name and also you have to set the three Const
statements which establish the row your first city is listed on, the column
where your cities are listed and the total number of column to be underlined
(starting with the city's column).

--
Rick (MVP - Excel)


"Philippe C." wrote in message
...
I have a list of cities with offices. I want a line to indicate a new
city.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default report - separator lines

Thanks from Antwerpen. It works.
I had thought in the direction of pivot tables.

Often in Visio I have to answer "Visio is not a drawing program"
I think Excel sadly is not a reporting tool.
I have worked in Crystal Reports yet.


Maybe I should use Access with Excel as an ODBC connection.



"Rick Rothstein" wrote:

Give this macro a try...

Sub LineAtCityChange()
Dim X As Long
Dim LastRow As Long
Const DataStartRow As Long = 2
Const CityColumn As String = "A"
Const TotalColumns = 3
With Worksheets("Sheet2")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Columns(CityColumn).Resize(, TotalColumns).Borders. _
LineStyle = xlLineStyleNone
For X = DataStartRow To LastRow
If Cells(X, CityColumn).Value < Cells(X + 1, CityColumn).Value Then
Cells(X, CityColumn).Resize(, TotalColumns). _
Borders(xlEdgeBottom). _
LineStyle = xlContinuous
End If
Next
End With
End Sub

You will have to change the worksheet reference in the With statement from
"Sheet2" to your own sheet name and also you have to set the three Const
statements which establish the row your first city is listed on, the column
where your cities are listed and the total number of column to be underlined
(starting with the city's column).

--
Rick (MVP - Excel)


"Philippe C." wrote in message
...
I have a list of cities with offices. I want a line to indicate a new
city.



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
Use 100 separator inspite of 1000 separator in excel Montu Excel Worksheet Functions 11 May 2nd 23 11:41 AM
Make a report with more lines that you can see on the screen Palle korsholm Excel Discussion (Misc queries) 1 March 11th 08 03:50 PM
How can I "autohide" certain lines in a financial report-as Sage Doug Kinsey Excel Discussion (Misc queries) 1 March 6th 08 12:13 AM
Automate Excel report to place certain data into existing report? Craig Harrison Excel Worksheet Functions 3 July 25th 06 01:54 PM
separator of thousands excelFan Excel Discussion (Misc queries) 2 December 27th 04 12:27 PM


All times are GMT +1. The time now is 01:32 PM.

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"