A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro to Format Lines Between Rows



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2008, 06:36 PM posted to microsoft.public.excel.misc
[email protected]
external usenet poster
 
Posts: 138
Default Macro to Format Lines Between Rows

I want to be able to go down column A in a worksheet and if the next entry is
not the same as the previous, I want to put a line between the two rows. How
would I go about doing this?

Thanks

Adam Bush
  #2  
Old August 19th, 2008, 06:59 PM posted to microsoft.public.excel.misc
Harald Staff
external usenet poster
 
Posts: 91
Default Macro to Format Lines Between Rows

Hi Adam

One way among many:

Sub test()
Dim R As Long
Dim V As Variant
V = Range("A1").Value
For R = 1 To Cells(Rows.Count, 1).End(xlUp).Row + 1
If Cells(R, 1).Value V Then
V = Cells(R, 1).Value
With Cells(R - 1, 1).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
End With
End If
Next
End Sub

HTH. Best wishes Harald
"
m skrev i melding
...
I want to be able to go down column A in a worksheet and if the next entry
is
not the same as the previous, I want to put a line between the two rows.
How
would I go about doing this?

Thanks

Adam Bush



  #3  
Old August 19th, 2008, 07:01 PM posted to microsoft.public.excel.misc
Joel
external usenet poster
 
Posts: 2,855
Default Macro to Format Lines Between Rows

Sub Addrows()

RowCount = 1
Do While Range("A" & RowCount) ""
If Range("A" & RowCount) Range("A" & (RowCount + 1)) Then
Rows(RowCount + 1).Insert
RowCount = RowCount + 2
Else
RowCount = RowCount + 1
End If
Loop

End Sub

" wrote:

I want to be able to go down column A in a worksheet and if the next entry is
not the same as the previous, I want to put a line between the two rows. How
would I go about doing this?

Thanks

Adam Bush

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:33 AM.


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