do not copy shapes into new sheet

deepak30

New Member
Joined
May 11, 2020
Messages
41
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
I have one worksheet wherein at the end of the year I create individual client wise bills to convert them into pdf
but the problem all the data comed in perfect way but the last page show the the shape to which i have assign the Marco that shapes also gets a copy and gets converted in pdf into the last page

I do not want that shapes to get copied into new excel sheet and get convereted into pdf
I have upload 2 images of the same pdf

VBA Code:
Sub S_SplitandFilterSheet()
Dim Splitcode As Range
Dim dalali As Long
Dim currentprogress As Double
Dim progressPercentage As Double
Dim BarWidth As Long
Dim message As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("pdfpath").Select
Dim path As String
Dim folder As String
Dim answer As VbMsgBoxResult

path = Range("B8").Value
folder = Dir(path, vbDirectory)

Sheets("Data").Select
If Range("A1").Value <> "ARIHANT ENTERPRISES" Then
    MsgBox "You Cannot Change Company Name"
    Exit Sub
End If
Set s_Splitcode = Range("s_Splitcode")
dlastrow = Worksheets("SellerMaster").UsedRange.Rows.Count
i = 0
Call initprogressbar

On Error Resume Next
For Each CELL In s_Splitcode
    If CELL.Value <> "" Then
        Sheets("Data").Copy After:=Worksheets(Sheets.Count)
        If ActiveSheet.Name = CELL.Value Then
            ActiveSheet.Name = CELL.Value + 1
        End If
        ActiveSheet.Name = Left(CELL.Value, 30)

        With ActiveWorkbook.Sheets(CELL.Value).Range("MasterData")
            .AutoFilter FIELD:=5, Criteria1:="<>" & CELL.Value, Operator:=xlFilterValues
            .Offset(0, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
        End With

        ActiveSheet.AutoFilter.ShowAllData
        If Range("E14") = "" Then
            ActiveSheet.Delete
        Else
            ' calculate amount and dalali
            Range("B5").Value = Range("E14").Value
            Range("A5").Value = "Seller Name"
            LastRow = ActiveSheet.Cells(Rows.Count, 4).End(xlUp).Row
            Range("K14").Select
            ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
            Selection.AutoFill Destination:=Range("K14:K" & LastRow)
        
            Range("L14").Select
            ActiveCell.FormulaR1C1 = "=RC[-1]*R13C12/100"
            Selection.AutoFill Destination:=Range("L14:L" & LastRow)
            Range("L14" & LastRow).Select
            
            'convert file to pdf in folder mention in PDFPath sheet
            If path = VBA.Constants.vbNullString Then
                MsgBox ("Please mention folder name in PDFPATH SHEET ?")
                Sheets("pdfpath").Select
                ActiveSheet.Delete
                Exit Sub
            Else
                If folder = vbNullString Then
                    answer = MsgBox("Folder Does Not Exit. Would you like to Create it?", vbYesNo, "Author Deepak Bhanushali")
                    Select Case answer
                    Case vbYes
                        VBA.FileSystem.MkDir (path)
                    Case Else
                        Exit Sub
                    End Select
                End If

            End If
            Columns(5).Delete
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            Filename:=path & ActiveSheet.Name & ".pdf", _
            quality:=xlQualityStandard, includedocproperties:=True, _
            ignoreprintareas:=False, openafterpublish:=False
            ActiveSheet.Delete
        End If
    Else
        MsgBox "Seller PDF Bills Created in your " & path
        Sheets("Data").Select
        Unload Progress
        Exit Sub
    End If
    i = i + 1
    currentprogress = i / dlastrow
    BarWidth = Progress.Border.Width * currentprogress
    progressPercentage = Round(currentprogress * 100, 0)
    
    Progress.Bar.Width = BarWidth
    Progress.Text.Caption = progressPercentage & "% Complete"
    DoEvents
    
Next CELL
    MsgBox "SELLER PDF Bills Created in your " & path
    Unload Progress
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    Sheets("Data").Select
End Sub
Sub initprogressbar()
With Progress
    .Top = Application.Top + 445 '< change 125 to what u want
    .Left = Application.Left + 1100 '< change 25 to what u want
    .Bar.Width = 0
    .message.Caption = "Please Wait Creating PDF File"
    .Text.Caption = "0% Complete"
    .Show vbModeless
End With
End Sub
 

Attachments

  • error on page 2.png
    error on page 2.png
    90.1 KB · Views: 29

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Problem Solved shapes do not print on last page of pdf but now It shows blank page.

what to do ? please guide
 
Upvote 0
Now when I convert my master data workbook into multiple PDFs it gives me the last page as a blank please guide
I just went step wise in vba and I found out this problem but not albe to solve

I have tried every thing but does not work
 

Attachments

  • Colmn L.png
    Colmn L.png
    151.9 KB · Views: 22
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top