daily pastebin goal
95%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub DoSomethingCool()
  2.     Dim vRws As Long, vRng As Range
  3.     Dim b As Range, b2 As Range, Wst As Worksheet
  4.  
  5.     Set Wst = Worksheets("RCV1")
  6.     Set WstRef = Worksheets("UniqueNames")
  7.     Set b2 = Wst.Range("b2")
  8.    
  9.     With WstRef
  10.  
  11.         vRws = .Cells(Rows.Count, "A").End(xlUp).Row
  12.         Set vRng = Range(.Cells(1, "A"), .Cells(vRws, "A"))
  13.    
  14.     Wst.PageSetup.PrintArea = "$A$1:$d$15"
  15.  
  16.     End With
  17.  
  18.     For Each b In vRng.Cells
  19.  
  20.         b2 = b
  21.  
  22.         Wst.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
  23.                                 "C:\Users\aforshee\Desktop\ReportCards" & b2.Offset(0, 1) & ".pdf", Quality:=xlQualityStandard,
  24.                                 IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
  25.                                 False
  26.     Next b
  27.  
  28.     MsgBox "Finished"
  29.  
  30. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top