+ Reply to Thread
Results 1 to 9 of 9

VBA to format PDF report

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    VBA to format PDF report

    Hi,

    I have a report which is only delivered to me via PDF and despite trying all PDF to Excel converters online it still doesn’t give me the results I want in excel.

    I therefore need to use a macro within excel but I no very very little about VBA. I am hoping someone is feeling generous to help with the code. I know the full code will be time consuming so if anyone can help with any of the rules it would be helpful.

    I have gone through the rules I believe I need, they are:
    1 Sheet is APP024
    2 Unmerge all cells
    3 Set Row height to 15
    4 All columns width = 10 apart from B which should be 30
    5 Delete row if column A contains contains any of the following "Business", "Code", "Page" or if row is blank. Only from ROW 3 Downwards
    6 Inset Row 6 - merge cells C6:E6 and place the text "Contribution From" and merge cells F6:H6 and place the text "Contributions To"
    7 Insert Row 7 and place the following text
    A7 Code
    B7 Business
    C7 Ex VAT £
    D7 VAT £
    E7 INC VAT £
    F7 Ex VAT £
    G7 VAT £
    H7 INC VAT £
    8 Make rows 6-7 bold
    9 If column A contains "Sub-total" make row bold and double underline A:H
    10 Freeze Pains - row 7

    I know a lot – and hopefully I have covered them all off.

    I have provided an example which shows the original format and the ideal format of what I want to achieve.

    Can anyone offer any help please?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: VBA to format PDF report

    Hi,

    I have been looking on the formum and this post:
    HTML Code: 
    Has many elements which I need.

    This example though copies the sheet and then formats the new sheet created keeping the oringal. I do not need to do that - I just dont know how to get started with this.

    Would it be worthwhile me recording each element manually to obtain the codes?

  3. #3
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: VBA to format PDF report

    Hi,

    I have made a bit of progress with this:

    This is my current code:
    Please Login or Register  to view this content.
    I would like to add the following to it but I am unsure how?

    Please Login or Register  to view this content.
    Can anyone help please?

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VBA to format PDF report

    As you know, VBA is not my best too, but this seems that works.

    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: VBA to format PDF report

    Thanks Fotis - this worked!!

    Please Login or Register  to view this content.
    This code currently looks within a cell and and finds the word Sub-Total then makes it red, bold and underlined.

    It currently works but it skips column B (I think because it is blank)? How do I fix the range so B is also underlined?

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VBA to format PDF report

    Sorry i missed your reply Paul.

    (I think because it is blank)?
    Yes we can not underlined something that not exist!

    I would suggest to recording a macro to use conditional formmating with a rule like =$a8="Sub-total"
    for column B to highlight red cells in column B that in column A, exist the word "Sub-total".

  7. #7
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: VBA to format PDF report

    I might be making this up but hopefully you can follow the logic

    Can the code be updated to include: Rows(N). and then set a column Range? e.g. Rows(N).Column.(A:H)?

    Pure guesswork so please be gentle.

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VBA to format PDF report

    I am not sure Paul. I think no.

  9. #9
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: VBA to format PDF report

    Hi pauldaddyadams

    Thanks for letting me know about 'xlUnderlineStyleDoubleAccounting'. I didn't know it existed and always added an extra line containing '=' signs. The following code may help you format a range on a row and to underline a blank cell (tested and working):
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 12-13-2014 at 01:00 PM.

+ 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. Excel Report Changes Format, Help
    By Barr_E in forum Excel General
    Replies: 0
    Last Post: 10-02-2014, 11:57 AM
  2. [SOLVED] change format Report to Data base format
    By elsg in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-01-2014, 06:34 PM
  3. [SOLVED] Macro to Format Report
    By miroslav23 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2013, 04:45 PM
  4. Spreadsheet to Report Format
    By a41ramo in forum Excel General
    Replies: 2
    Last Post: 02-18-2010, 11:15 PM
  5. report output format
    By Tim3057 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2006, 11:10 AM

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