I am having a problem with formatting in excel and I don't know how to resolve it. I have the page setup to repeat the first two rows on the top of each recurring page. The last row of each page has a double line for the whole row. Somehow the double line is showing up on the bottom of the second row of the second and third pages not the first page, it is not supposed to be there. Any help would be appreciated.
Code:
'Page Setup
With goXL.ActiveSheet.PageSetup
.PrintTitleRows = ("A1" & ":" & "A2")
.PrintArea = "A1:P" & iEndRow + 1
.LeftMargin = goXL.Application.InchesToPoints(0.25)
.RightMargin = goXL.Application.InchesToPoints(0.25)
.TopMargin = goXL.Application.InchesToPoints(0.4) 'Changed margin from 0.5 to 0.4
.BottomMargin = goXL.Application.InchesToPoints(0.5)
.HeaderMargin = goXL.Application.InchesToPoints(0.25)
.FooterMargin = goXL.Application.InchesToPoints(0.25)
.LeftFooter = Format(dtmDate, "dddd, mmmm dd, yyyy")
.RightFooter = "Pages " & "&P"
.Orientation = xlLandscape
.Zoom = 80
With goXL.Sheets("ASOData")
.Cells(iEndRow + 2, 1).Select
.HPageBreaks.Add Before:=ActiveCell
End With
End With
'Code that calls the doubleline function
'This is part of a loop iEnd is set for the last row
Call XLFormatDoubleLine(iEndRow, 2, 16)
'Funtion that is being called
Public Sub XLFormatDoubleLine(iRow As Integer, iLeftCol As Integer, iRightCol As Integer)
' ************************************************************************************************
' *** THIS SUB CREATES A DOUBLE LINE IN A GIVEN RANGE OF CELLS ON ACTIVE OBJECT ***
' ************************************************************************************************
Dim strLeftLetter As String
Dim strRightLetter As String
strLeftLetter = ConvColLet(iLeftCol)
strRightLetter = ConvColLet(iRightCol)
With goXL.ActiveSheet.Range("" & (strLeftLetter) & (iRow) & ":" & (strRightLetter) & (iRow) & "").Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End Sub