ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Drawing a line for a set range (https://www.excelbanter.com/excel-programming/444296-drawing-line-set-range.html)

Neil[_34_]

Drawing a line for a set range
 
Hi

I currently have data in columns A - J.

I currently have a macro that separates the rows of data based on
variables (see below). What i need to incorporate into this is that
after each line is inserted to draw a line from Ax - Jx (where x is
the new row).



Sub Insert_Rows()

Rw = 2
LastRow = 20000

NxtChk:
If Cells(Rw, "B") < Cells(Rw + 1, "B") Then
Rows(Rw + 1).EntireRow.Insert

Rw = Rw + 1

NewRow = NewRow + 1
End If

If Rw = LastRow + NewRow Then Exit Sub
Rw = Rw + 1

GoTo NxtChk

ActiveWindow.DisplayGridlines = False

End Sub

Any help would be greatly appreciated.

Thanks
Neil

AB[_2_]

Drawing a line for a set range
 
Why do you need a line? Wouldn't a Border do instead?

Have you tried recording a macro for what you need and then fine-
tuning it?

On Mar 2, 12:40*am, Neil wrote:
Hi

I currently have data in columns A - J.

I currently have a macro that separates the rows of data based on
variables (see below). What i need to incorporate into this is that
after each line is inserted to draw a line from Ax - Jx (where x is
the new row).

Sub Insert_Rows()

Rw = 2
LastRow = 20000

NxtChk:
If Cells(Rw, "B") < Cells(Rw + 1, "B") Then
Rows(Rw + 1).EntireRow.Insert

Rw = Rw + 1

NewRow = NewRow + 1
End If

If Rw = LastRow + NewRow Then Exit Sub
Rw = Rw + 1

GoTo NxtChk

ActiveWindow.DisplayGridlines = False

End Sub

Any help would be greatly appreciated.

Thanks
Neil




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com