• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Print multiple columns but only rows with data

delamarejames

New Member
I haven't been able to find anything on this topic on my own. I am trying to put together a spreadsheet to compile orders from multiple customers. there are 86 possible items customers can order, but most days there are only 10 to 20 of the items ordered. I have the products listed in a column followed by 45 columns for customers. Ideally when it comes time to print hard copies for the production and packaging floor personnel, I would like to print only the items that are ordered rather than have 65-75 blank rows. Using the filter in the data tab it works great for 1 customer column, but to try and print all of the customer columns using the filter (on each column) it consolidates the list to only those rows in which all columns have an entry. Any ideas would be appreciated


Thanks,


James
 
Good day delamarejames


Put this code in to a module put a button on your sheet and assign the marco to it


Sub PrintA()

'prints rows of data, will not print rows if column A is blank

Application.ScreenUpdating = False

Range("A:A").EntireRow.Hidden = False

Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True

ActiveWindow.SelectedSheets.PrintOut Copies:=1

Range("A:A").EntireRow.Hidden = False

Application.ScreenUpdating = True

End Sub
 
Thank you bobhc,

I tried a few times but have not succeeded in getting your solution to work. That is probably because I am a VBA virgin. I will keep trying to learn how to input your suggestion. Looking at your code will the range A:A change to B:B, C:C etc? for each successive column?


What i tried was to copy your post from Sub PrintA() to end sub and paste it into an opened insert module (I had changed macros security to allow all macros) I added a button but nothing really happened when I clicked on the button. Hopefully I will figure it out.

Thank you again for your response
 
Good day delamarejames


The code works as tested but you must be getting stuck as the where to put it. I put these bits of code into a module and then make a button by inserting a shape and assigning the macro to it.

I have put a sample workbook into my Dropbox please have a look and open up the VBA window and then open up the module. If there is nothing in a cell in row A then that row in its entirety does not get printed. If you right click on the tab named DoNotPrint and then select View Code the VBA editor will open up, just look to the top left window and double click on the module called NotPrint.


https://dl.dropbox.com/u/75495784/Dummy_Data-Donot-Print-Empty-Rows.xlsm
 
Back
Top