PapaRainman
New Member
- Joined
- Dec 19, 2019
- Messages
- 6
- Office Version
- 2019
- Platform
- Windows
Hi Guys!
It is my first time here on Mr.Excel forums and would want to seek for your help.
What I would want to do is to:
1. Select the cells that has value
2. Skip selecting the entire row or cells that has "False" word in it, as there is an IF formula that returns false if it has no value to consider
3. Include the total amount at the very bottom
4. Include the #N/A as it is a valid information, I think it will be included once we selected cells with value
5. Selecting the cells with values and print it as PDF
I was able to do the print it as PDF but 1-3 and selecting the cells with values before printing is what really bugs me.
Here is my code:
I also included a screenshot of what it looks like.
Thank you very much and hope you could help me.
It is my first time here on Mr.Excel forums and would want to seek for your help.
What I would want to do is to:
1. Select the cells that has value
2. Skip selecting the entire row or cells that has "False" word in it, as there is an IF formula that returns false if it has no value to consider
3. Include the total amount at the very bottom
4. Include the #N/A as it is a valid information, I think it will be included once we selected cells with value
5. Selecting the cells with values and print it as PDF
I was able to do the print it as PDF but 1-3 and selecting the cells with values before printing is what really bugs me.
Here is my code:
VBA Code:
Sub SelectAndCreatePDF()
Dim i As Integer, PDFindex As Integer
Dim PDFfileName As String
Dim LR As Long, cell As Range, rng As Range
Range("A1:H12").Select
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF
ActiveSheet.PageSetup.PrintArea = "A1:H12"
With Application.FileDialog(msoFileDialogSaveAs)
PDFindex = 0
For i = 1 To .Filters.Count
If InStr(VBA.UCase(.Filters(i).Description), "PDF") > 0 Then PDFindex = i
Next
.Title = "Save sheet as PDF"
.InitialFileName = PDFName
.FilterIndex = PDFindex
If .Show Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=.SelectedItems(1), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End With
End Sub
I also included a screenshot of what it looks like.
Thank you very much and hope you could help me.