I have an Excel 2010 workbook that creates another workbook and copies some data to it. Everything works fine until I create the Header, at which point vertical page breaks are inserted every few columns of the new workbook. It's not a consistent number of columns in between the breaks. I can't remove them with VBA or even by manually clicking "Reset All Page Breaks".
There are NO page breaks in the workbook that creates the new workbook, so they aren't being copied. They don't appear until the Header is created.
I'm at my wits end, this is due in a couple of days and I can't finish without solving this. Here's the code that creates the header (I've deleted some confidential information but it's just literal strings so it shouldn't matter):
Any help appreciated!
There are NO page breaks in the workbook that creates the new workbook, so they aren't being copied. They don't appear until the Header is created.
I'm at my wits end, this is due in a couple of days and I can't finish without solving this. Here's the code that creates the header (I've deleted some confidential information but it's just literal strings so it shouldn't matter):
Code:
Function DoManifestHeader(wb As Workbook)
'Creates and populates Header for Manifest
Dim sLeftHeader As String
Dim sCenterHeader As String
Dim sRightHeader As String
Dim sSponsor As String
Dim sProtocol As String
Dim sStudyNumber As String
Dim sSpecimenType As String
Dim sPMName As String
Dim sPMPhone As String
Dim ws As Worksheet, wsInfo As Worksheet
Set ws = wb.Worksheets("Shipping Manifest")
Set wsInfo = wb.Worksheets("Information")
sSponsor = wsInfo.Range("C2").Value
sProtocol = wsInfo.Range("C4").Value
sStudyNumber = wsInfo.Range("C5").Value
sSpecimenType = wsInfo.Range("C9").Value
sPMName = wsInfo.Range("C6").Value
sPMPhone = wsInfo.Range("C7").Value
sLeftHeader = "Company Name" & vbCr _
& "Address" & vbCr _
& "City, State Zip" & vbCr _
& "Phone"
sCenterHeader = "Sponsor: " & sSponsor & vbCr _
& "Protocol: " & sProtocol & vbCr _
& "Study Number: " & sStudyNumber & vbCr _
& "Specimen Type: " & sSpecimenType & vbCr _
& "Project Manager: " & sPMName & vbCr _
& "PM Phone: " & sPMPhone
sRightHeader = "&F"
With ws.PageSetup
.LeftHeader = sLeftHeader
.CenterHeader = sCenterHeader
.RightHeader = sRightHeader
End With
End Function
Any help appreciated!