How to draw lines to seperate data
Garry
This sub does it for columns A and B. If you need help making it relative to whatever columns are selected, post back. Sub CreateUnderlines() Dim rCell As Range For Each rCell In Sheet1.Range("A1:A9").Cells If rCell.Value < rCell.Offset(1, 0).Value Then Intersect(rCell.EntireRow, rCell.Parent.UsedRange) _ .Borders(xlEdgeBottom).LineStyle = xlContinuous ElseIf rCell.Offset(0, 1).Value < rCell.Offset(1, 1).Value Then Intersect(rCell.EntireRow, rCell.Parent.UsedRange) _ .Borders(xlEdgeBottom).LineStyle = xlDash End If Next rCell End Sub -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "garrylwhiting" wrote in message ... I would like to create a macro to automaticly insert a solid or dash line to seperate data after each change in value of any given column. As an example after the data sheet has been sorted using column A "car manufacture" all the Chevy, Ford, or Honda would have a solid line drawn under the data. Also within each group, column B "type of vehicle", (car, pickup, SUV) would be seperated with a dash line. I would like to be able to use a User Form to select which cloumn will be underlined using the solid line and which will column will be underlined using the dash line. -- garrylwhiting ------------------------------------------------------------------------ garrylwhiting's Profile: http://www.excelforum.com/member.php...o&userid=16214 View this thread: http://www.excelforum.com/showthread...hreadid=276298 |
All times are GMT +1. The time now is 03:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com