VBA code to sort, copy, paste and email the pdf

  • Hi All,

    I am trying to work out VBA code to do the following,

    • Select Sheet “ABL”
    • Row 10 has headings (column A to N)
    • Sort data by Alphabet in Column H – values Critical, High, Medium and Low – Filters are on.
    • Select all rows with Critical and High value in Column H.
    • Copy this data.
    • Select sheet “DBL” – Row 46 has headings and formats, same as of sheet ABL
    • Clear all the rows from 47 onwards in sheet DBL – Row 1 – 46 has some graphs.
    • Paste the data into DBL from row 47 onwards which was copied from sheet ABL with High and Critical Values (column H). Format must be same.
    • Convert DBL into pdf – only rows with data.
    • Email this pdf using tbl_Main_Email_List as To: and tbl_CC_Email_list as CC:.

    I have worked out a code to do above but main issues are,

    • Data will vary from week to week i.e. one week it may only have 5 rows with High and Critical and next week it may have 10, week after maybe 2.
    • When the data is pasted into sheet DBL, it does not copy the borders.

    Code is pasted below, it does not contain data sort, copy and paste information. It does contain some MsgBox Input which I would like to retain.




    Apologies if it has been requested before but I could not find any specific reference. Any help in above will be appreciated.

  • If you would take the time to attach the file (remove sensitive data) it will make is easier to work with the data instead of filling in something ourselfves

    Hans
    "IT" Always crosses your path :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!