以空格格式导出Excelsheet中的PDF,无空格

需要我的苦难的解决scheme。 这下面的代码工作,但问题是它显示我作为一个完整的网站的空白空间。 我想知道是否有可能“缩水”?

收缩应该开始@列“F”

这是代码:

Private Sub CommandButton1_Click() Dim mySheets As Variant, sh mySheets = Array("Tabelle1") For Each sh In mySheets Sheets(sh).PageSetup.Orientation = xlLandscape Next Range("A1:CR33").Select Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\export.pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True End If End Sub 

在这里插图的图片。 这是我得到: http : //www.bilder-upload.eu/show.php ?file= e31421-1438765650.jpg

这是我想要的: http : //www.bilder-upload.eu/show.php ?file= a9f566-1438765707.jpg

谢谢

我想这是你以后的事情:

Private Sub CommandButton1_Click()Dim mySheets As Variant,sh

 mySheets = Array("Tabelle1") For Each sh In mySheets Sheets(sh).PageSetup.Orientation = xlLandscape Next For Each the_cell In Range("A1:A33") If the_cell.Value = "" Then the_cell.EntireRow.Hidden = True Else Exit For End If Next the_cell Range("A1:CR33").Select Selection.ExportAsFixedFormat Type:=xlTypePDF, fileName:=ThisWorkbook.Path & "\export.pdf", _ quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True Range("A1:A33").EntireRow.Hidden = False End Sub 

本质上,我已经添加了一个循环 – 这将隐藏单元格之前第一个填充行(和取消隐藏后)

希望这可以按照你的意图工作

Interesting Posts