ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Borders/Inserting Lines (https://www.excelbanter.com/excel-programming/318951-borders-inserting-lines.html)

Teresa

Borders/Inserting Lines
 
I have a couple of issues with my code:
1) Putting the borders in , my code to do this is asterisked below, doesnt run
2)Also need to insert a line btw each account in Changes.xls

Thanks A Million


I want to get from:

Jobs.xls:

Client Jan Feb Mar
GATT 100 150 250
CHEV 99 200 400


Jobs2.xls:

Client Jan Feb Mar
GATT 200 250 350
CHEV 199 300 1000


i NEED TO GET TO:

Changes.XLS

Client Jan Feb Mar
GATT 200 250 350
100 150 250
-------------------------------
100 100 100

CHEV 199 300 1000
99 200 400
-------------------------------
100 100 600



Sub des()

Worksheets.Add.Name = "Changes"

k = 2
For i = 1 To 20
For j = 1 To 20
If Worksheets("Jobs").Cells(i, j) <
Worksheets("Jobs2").Cells(i, j) Then
Worksheets("Jobs2").Cells(i, j).EntireRow.Copy _
Destination:=Worksheets("Changes").Cells(k, 1)
Worksheets("Jobs").Cells(i, j).EntireRow.Copy _
Destination:=Worksheets("Changes").Cells(k + 1, 1)
With Worksheets("Changes")
.Cells(k + 1, 1).ClearContents
For m = 2 To 20
.Cells(k + 2, m).Value = .Cells(k, m) - .Cells(k + 1, m)
* .Cells(k + 2, m).borders (xlEdgeBottom)
* .Cells(k + 2, m).LineStyle = xlContinuous
* .Cells(k + 2, m).Weight = xlMedium
* .Cells(k + 2, m).ColorIndex = xlAutomatic
Next m
End With
k = k + 3
Exit For
End If
Next j
Next i

End Sub



Tom Ogilvy

Borders/Inserting Lines
 
Sub ABCD()
k = 5
For m = 1 To 20
With Worksheets("Change")
With .Cells(k + 2, m).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With
Next
End Sub

for the blank line, change
k = k + 3
to
k = k + 4

--
Regards,
Tom Ogilvy


"teresa" wrote in message
...
I have a couple of issues with my code:
1) Putting the borders in , my code to do this is asterisked below, doesnt

run
2)Also need to insert a line btw each account in Changes.xls

Thanks A Million


I want to get from:

Jobs.xls:

Client Jan Feb Mar
GATT 100 150 250
CHEV 99 200 400


Jobs2.xls:

Client Jan Feb Mar
GATT 200 250 350
CHEV 199 300 1000


i NEED TO GET TO:

Changes.XLS

Client Jan Feb Mar
GATT 200 250 350
100 150 250
-------------------------------
100 100 100

CHEV 199 300 1000
99 200 400
-------------------------------
100 100 600



Sub des()

Worksheets.Add.Name = "Changes"

k = 2
For i = 1 To 20
For j = 1 To 20
If Worksheets("Jobs").Cells(i, j) <
Worksheets("Jobs2").Cells(i, j) Then
Worksheets("Jobs2").Cells(i, j).EntireRow.Copy _
Destination:=Worksheets("Changes").Cells(k, 1)
Worksheets("Jobs").Cells(i, j).EntireRow.Copy _
Destination:=Worksheets("Changes").Cells(k + 1, 1)
With Worksheets("Changes")
.Cells(k + 1, 1).ClearContents
For m = 2 To 20
.Cells(k + 2, m).Value = .Cells(k, m) - .Cells(k +

1, m)
* .Cells(k + 2, m).borders (xlEdgeBottom)
* .Cells(k + 2, m).LineStyle = xlContinuous
* .Cells(k + 2, m).Weight = xlMedium
* .Cells(k + 2, m).ColorIndex = xlAutomatic
Next m
End With
k = k + 3
Exit For
End If
Next j
Next i

End Sub






All times are GMT +1. The time now is 01:38 AM.

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