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
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