+ Reply to Thread
Results 1 to 3 of 3

VBA Code/Macro for transferring information from form to report.

Hybrid View

  1. #1
    Registered User
    Join Date
    02-23-2022
    Location
    USA
    MS-Off Ver
    365
    Posts
    5

    VBA Code/Macro for transferring information from form to report.

    Hello,
    I am trying to accomplish something, and I do not know if it is even possible.
    Purchase Order Tab:
    PO#
    PO Date
    Job Name
    Job Code
    Vendor Company
    Shipping Contact
    Order Total
    I would like for these items to be copied and then pasted into corresponding cells in "PO Report"
    with always going to first available blank "A" cell.
    I would like to turn this into a macro for button "Save/PDF" for it to send the info into "PO Report" and also prompt to save as pdf inside the green border of "Purchase Order"
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,892

    Re: VBA Code/Macro for transferring information from form to report.

    Try

    Sub SaveSelectionToPDF()
    Dim rng As Range
    Dim newpdfname As String
    Dim pdfpath As String
    Set rng = Application.Selection
    Set rng = Range("D2:I38")
    newpdfname = Application.InputBox("Please Enter a name for the new PDF")
    With ActiveSheet.PageSetup
            .FitToPagesWide = 1
            .FitToPagesTall = 1
     End With
    pdfpath = ThisWorkbook.Path & "\" & newpdfname
    rng.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=pdfpath, _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
    
    Update_PO_Report
    
    End Sub
    
    Sub Update_PO_Report()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Set ws1 = Worksheets("Purchase Order")
    Set ws2 = Worksheets("PO report")
    caddr = Array("I2", "I3", "I4", "I5", "E7", "I38", "G8", "G9", "G10", "G11")
    
    nxtrec = ws2.Cells(Rows.Count, 1).End(xlUp).Row + 1
    For i = 0 To UBound(caddr)
    ws2.Cells(nxtrec, i + 1) = ws1.Range(caddr(i))
    Next i
    End Sub
    Click "Save/PDF" button
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    02-23-2022
    Location
    USA
    MS-Off Ver
    365
    Posts
    5

    Re: VBA Code/Macro for transferring information from form to report.

    You are a master, thank you so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I need a code to import information into a word on a form.
    By spudn56 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2020, 01:07 PM
  2. [SOLVED] Extracting information from Crystal report subtotal to standard form
    By Raehan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-18-2017, 05:58 PM
  3. [SOLVED] Amended VBA Code to Input information into form for viewing
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-12-2015, 06:48 AM
  4. Need macro to show information in a report only when critera are meant
    By superchew in forum Access Tables & Databases
    Replies: 7
    Last Post: 09-30-2014, 05:48 AM
  5. Need suggestion on macro to form a report
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2010, 11:44 PM
  6. Macro to form a simple report
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2010, 11:25 PM
  7. [SOLVED] Transferring information from one user form to another
    By michelle.harshberger@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 06:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1