Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
I have this code that inserts blank rows to size the overall table to fill a page.
Th code inblue is doing the actual adding. I have no problem with the concept.
The problem I am having is with borders.
The table cells are bordered with extrathin black lines top and bottom and thin lines to the left and right.
After the lines are inserted, I am missing extrathin lines in the range for which the rows were inserted. The range of cells in column B that don't have the extrathin horizontal borders always fall directly under a merged cell.
https://image.ibb.co/jriuQk/30_04.jpg
What code could I use, and where can I add it, to return the horizontal line to the cells missing them.
I see these maybe used ...
Rich (BB code):
With va
.Activate
markrow = Application.WorksheetFunction.Match("mark", .Range("A1:A200"), 0)
llrow = markrow + 4
For Each q In .Range("A1:A" & llrow)
ptrh = ptrh + q.Height
Next q
diff = dph - ptrh
rta = WorksheetFunction.RoundDown((diff / 12.75), 0)
MsgBox "Default page height: 579.75 pts" & Chr(13) & "Current page height: " & ptrh & " pts" & Chr(13) & "Difference: " & diff & " pts" & Chr(13) & "Rows to add: " & rta
If rta > 0 Then
a_pda = WorksheetFunction.RoundDown((0.6 * rta), 0)
a_fma = rta - a_pda
fmarow = Application.WorksheetFunction.Match("Facility Maintenance Activities", .Range("A1:A200"), 0)
lrow_pda = fmarow - 3
Set ac = ActiveSheet.Cells(lrow_pda, 1)
For add_apda = 1 To a_pda
ac.offset(add_apda).EntireRow.Insert
Next add_apda
.Range("H" & lrow_pda + 1 & ":Q" & lrow_pda + a_pda).Interior.ColorIndex = RGB(0, 0, 0)
fmarow = Application.WorksheetFunction.Match("mark", .Range("A1:A200"), 0)
lrow_fma = fmarow - 1
Set ac = ActiveSheet.Cells(lrow_fma, 1)
For add_afma = 1 To a_fma
ac.offset(add_afma).EntireRow.Insert
Next add_afma
End If
On Error Resume Next
.Range("A" & lrow_fma + a_fma) = ""
On Error GoTo 0
gh1 = Application.WorksheetFunction.Match("mark", .Range("A:A"), 0)
.Range("A" & gh1) = ""
End With
Th code inblue is doing the actual adding. I have no problem with the concept.
The problem I am having is with borders.
The table cells are bordered with extrathin black lines top and bottom and thin lines to the left and right.
After the lines are inserted, I am missing extrathin lines in the range for which the rows were inserted. The range of cells in column B that don't have the extrathin horizontal borders always fall directly under a merged cell.
https://image.ibb.co/jriuQk/30_04.jpg
What code could I use, and where can I add it, to return the horizontal line to the cells missing them.
I see these maybe used ...
Rich (BB code):
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1