PDF to EMAIL - change to range of cells to print

  • Hi I am wondering if you experts could assist me please. I am using Ron Debruins PDF to email code. It works wonders however I am wondering if there is a way that the range of cells printed to PDF can be changed when there is a value in a particular cell.


    For example:


    Code
    FileName = RDB_Create_PDF(Source:=Range("M14:T46"), _                                  FixedFilePathName:="", _
                                      OverwriteIfFileExist:=True, _
                                      OpenPDFAfterPublish:=False)


    However if there is a value in cell Cell R73, if would like the pdf to print the range M14:T76


    Any assistance would be greatly appreciated.


    With thanks


    Christine

  • Re: PDF to EMAIL - change to range of cells to print


    As an example.


    Code
    ... RDB_Create_PDF(Source:=IIF(Range("R73") <> vbNullString, Range("M14:T76"), Range("M14:T46")), FixedFilePath...
  • Re: PDF to EMAIL - change to range of cells to print


    THANK YOU SO MUCH FOR YOUR SUPER QUICK REPLY.


    I cannot test this at the moment as I am not on the PC with the spread sheet. I will come back to you tomorrow once I have inserted the code albeit I suspect it will work wonderfully.


    You are truly amazing and I will post again tomorrow with an update. FYI I am in Australia so I will be about 12+ hours or so before I reply again.


    Thank you again so very much. Your help is greatly appreciated.


    Christine.

  • Re: PDF to EMAIL - change to range of cells to print


    Hi Again,


    The additional code is working well only if I manually place text in cell R73 however it doesnt work if there is a formula in that cell. The formula in the cell is

    Code
    =SUM(R56:S71)

    . So hoping you are able to help with this so the range to print to PDF becomes M14:T73 only when their is a total of the formula sum in R73.


    Thank so very much again. your help is greatly appreciated.


    Regards


    Christine

  • Re: PDF to EMAIL - change to range of cells to print


    Change the comparison to > 0, <> 0 or whatever you need.


    I just went with your original comment "if there is a value" which means, in Excel terms, if anything is in the cell... so it checked for an empty cell.

  • Re: PDF to EMAIL - change to range of cells to print


    Absolutely wonderful. Thank you so very very much. You are brilliant. Thank you. You have made my day.


    Cheers


    Christine

Participate now!

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