+ Reply to Thread
Results 1 to 9 of 9

Removing Extra Empty Columns From Generated PDF?

  1. #1
    Registered User
    Join Date
    09-14-2018
    Location
    Eastern US
    MS-Off Ver
    2010
    Posts
    15

    Removing Extra Empty Columns From Generated PDF?

    This has to be something so simple I am missing. I have a CSV file loaded into Excel that I am then turning into a generated PDF file. I seem able to clear out columns in the process (even columns containing data, I can get that data to blank as part of the macro). However, the PDF is still printing 2 more columns than I want. Is there a simple part of the PDF command that I can run to force the column ranges that print as part of the PDF file? It's killing me.

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Removing Extra Empty Columns From Generated PDF?

    Are any hidden columns lurking? Double check your print range. . .
    Try saving as .xlsx. Then print.
    Pete

  3. #3
    Registered User
    Join Date
    09-14-2018
    Location
    Eastern US
    MS-Off Ver
    2010
    Posts
    15

    Re: Removing Extra Empty Columns From Generated PDF?

    No hidden columns, though perhaps the conversion process I used to build the CSVs put spaces or something in the columns that causes the macro generating the PDF to think I want those last 2 columns? Is there a command to set the print range I can run before the PDF generate (or as part of it)? That may be what I'm missing here. Amateur macro builder who inherited this macro.

  4. #4
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Removing Extra Empty Columns From Generated PDF?

    You can try the TRIM command.

    Please Login or Register  to view this content.
    Pete

  5. #5
    Registered User
    Join Date
    09-14-2018
    Location
    Eastern US
    MS-Off Ver
    2010
    Posts
    15

    Re: Removing Extra Empty Columns From Generated PDF?

    Thank you so much. I will give this a try. Also wondering — is there a simple command that just allows you to set a certain range of columns as your active print range and ignore any other columns after?

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Removing Extra Empty Columns From Generated PDF?

    Yes. On the PageLayout ribbon there is a "Select Print Range" option.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    09-14-2018
    Location
    Eastern US
    MS-Off Ver
    2010
    Posts
    15
    Oh yes that I know. I meant is there a way to do it in my macro. My macro generates 20 csv files from 20 text delimited input files, formats and prtints them to a PDF, xls, and new txt version (60 files total). I’d like to programmatic ally set the csv print area inside the macro before each PDF prints so the 2 rightmost empty columns don’t show.
    Last edited by bdpna; 11-13-2018 at 02:48 PM.

  8. #8
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Removing Extra Empty Columns From Generated PDF?

    Why not just define the print range in the macro? Your recorder should create the code, you can place it into the desired spot in your macro. Be sure to use relative references.

    Pete

  9. #9
    Registered User
    Join Date
    09-14-2018
    Location
    Eastern US
    MS-Off Ver
    2010
    Posts
    15

    Re: Removing Extra Empty Columns From Generated PDF?

    Thanks guys, using the recorder to get the range right plus the active range command did it. Thanks for bearing with me. Solved!

+ 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. returning totals line in sheet with extra empty columns and rows
    By sjferrera in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2017, 01:51 PM
  2. [SOLVED] Removing blank lines from generated results
    By MagicMan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-23-2017, 03:02 PM
  3. [SOLVED] Removing Extra Whitespace
    By sperry2565 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-03-2013, 10:00 AM
  4. [SOLVED] Removing extra spaces
    By Serge77 in forum Excel General
    Replies: 4
    Last Post: 02-01-2013, 05:37 PM
  5. Removing extra sheets.
    By pawnraider in forum Excel General
    Replies: 6
    Last Post: 11-29-2012, 11:46 AM
  6. Replies: 8
    Last Post: 08-27-2012, 04:37 PM
  7. Replies: 3
    Last Post: 03-20-2005, 12:06 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