ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Question for T.Ogilvy (https://www.excelbanter.com/excel-programming/318966-question-t-ogilvy.html)

Teresa

Question for T.Ogilvy
 
Hi Tom,
Thanks a lot for your help, I tried running by inserting the code but it
didn't work,
Do I insert this code within my original macro or is this a separate macro
which I call from my original macro


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



Tom Ogilvy

Question for T.Ogilvy
 
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)
With .Cells(k + 2, m).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Next m
End With
k = k + 3
Exit For
End If
Next j
Next i

End Sub

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Hi Tom,
Thanks a lot for your help, I tried running by inserting the code but it
didn't work,
Do I insert this code within my original macro or is this a separate macro
which I call from my original macro


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






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

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