PDA

View Full Version : [SOLVED] Print to last row, multipule columns.



Barryj
02-13-2015, 07:22 AM
I have a print macro that I am using on another project to detemine the last row of data to print, I now have another project where I need to print to the last row but that last row could be of any four columns.

Columns A, F, K, P have data, they all contain different lenght rows of data and it is different every time the data needs to be printed, how would I go about coding to take the different columns data into consideration so that it prints to the bottom of the column with the most data?

Current print macro

Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.PageSetup.PrintArea = "B1:N" & LastRow
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End With

Thanks

mancubus
02-13-2015, 07:36 AM
try:



LastRow = .Cells.Find("*", , , , xlByRows, xlPrevious).Row

Barryj
02-13-2015, 07:55 AM
Thanks mancubus that works great, thankyou for your quick response.

mancubus
02-13-2015, 08:54 AM
you are welcome. thanks for the feedback and marking the thread as solved.