none
Macro to run through a list of numbers and create output for each entry RRS feed

  • Question

  • I am trying to run data based on a list of cost center numbers and then create a consolidated pdf.

    I am trying to figure out how to copy z1, paste to a1, and then repeat for the entire list of numbers in the column

    Monday, February 8, 2016 9:35 PM

Answers

  • Try this:

    Sub CopyNumbers()

    Dim intBottomRow As Integer 'Variable for  last row in column Z

        intBottomRow = Cells(Rows.Count, 26).End(xlUp).Row 'Go to bottom of col Z, then End UP to find last used row.
        Range("Z1:Z" & intBottomRow).Copy Destination:=Range("A1") 'Copy column Z to column A
        ActiveWorkbook.Save
       
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
            Filename:="Filepath\Filename.pdf", _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=False, _
            IgnorePrintAreas:=True, _
            OpenAfterPublish:=True

    End Sub

        This copies all of the data in column Z to column A, then saves, then exports whole sheet as a pdf file.  You need to fill in the relevant data in the Filename line to give to location and name of the pdf file.

    Hope this helps

    Andy C

    Tuesday, February 9, 2016 11:43 AM