Results 1 to 7 of 7

How do i write code for saving a pdf based on a cell name and also how to auto copy ?

Threaded View

  1. #1
    Registered User
    Join Date
    04-16-2015
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    40

    Angry How do i write code for saving a pdf based on a cell name and also how to auto copy ?

    I have 3 worksheets; REPORT, RECORD, and SHADOW RECORD. Report is filled out by the user and when they fill it in the data appears in SHADOW RECORD. When they click SAVE the data in SHADOW RECORD is copied from shadow record to RECORD. After which, the report that the user fills in is then saved as a pdf with the default name of the Inspection Number.

    However I am having problems writing code for this as I have done this manually and I think it is one of those things where the code is much more efficient than doing it manually. This is what my manual steps look like :

    '
    ' SAVE Macro
    ' RECORDLOG + PDF
    '
    
    '
        Sheets("SHADOWRECORD").Select
        Range("A2:J2").Select
        Selection.Copy
        Sheets("RECORD").Select
        Range("A2").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Rows("2:2").Select
        Application.CutCopyMode = False
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Sheets("REPORT").Select
        Range("C1:Q71").Select
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "\\Domain01\UserData$\Desktop\H&S MOCK 001.pdf", Quality:= _
            xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
            OpenAfterPublish:=True
        
    End Sub
    Basically when I run the macro the information being copied from SHADOW RECORDS to RECORDS is not consistent and when I did it manually I inserted a row manually after I had pasted special (values) into the first row underneath the column titles in row 1. The pdf can be created but the saving of it is difficult as you are having to manually save the document rather than doing it automatically. Should I ditch the manual and go vba ? and what should my code look like?
    Attached Files Attached Files
    Last edited by QuintonMcCloud; 11-24-2015 at 06:25 AM. Reason: code does not comply with forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Auto Filtering based on Cell Value? Code Required.
    By SharpL in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-22-2014, 04:57 AM
  2. Auto Filtering based on Cell Value? Code Required.
    By SharpL in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-19-2014, 10:01 AM
  3. Replies: 0
    Last Post: 06-11-2013, 05:14 PM
  4. [SOLVED] UserForm in Excel- need to write code to auto fill a text field
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-09-2013, 10:58 AM
  5. [SOLVED] write code to copy a current variables value into next available cell in worksheet
    By damayn83 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2013, 04:32 PM
  6. auto filter event code based on cell two cell value
    By njan1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2013, 09:02 AM
  7. how write to rows selected by auto/advanced filter in VBA code
    By xdalibor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2011, 11:28 AM

Tags for this Thread

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