Macro/VBA: issue cpoy paste with cells qty. and format

Arthur_

New Member
Joined
Dec 29, 2016
Messages
3
Hello,

i started to create a macro to copy all data from row "A" from worksheet1 to a different worksheet (worksheet2) and paste it after that a print preview window will shown and it can be printed. i'm not that good in macros.

i struggle to get the some more things done:
i'm not sure if i copy the whole column A or what it should copy only the cell with data not empty cells (in all cells is a code)
first i would like that the data and format is cleared after printing on the worksheet 2
second issue i have is that the data should be copied on a A4 format (means in column A 50 cells column C 50 cells next 50 cells in column E, next 50 should go into column A in the first empty cell, and so on until all cells copied not empty cells are copied from worksheet1. we need column B, D, E to fill in data on the printed A4, each column should be 15 wide and the row should be 13.3 high; on each column and new A4 Page i would like to have the header copied.
the format should also create borders on the cells with data.

this should all happen on push the button print

this is my code i have right now.

Sub Print_Area()


Worksheets("Empty Loc Report").Activate
Dim Selection As Range
Set Selection = Range("A:A")

Selection.Select
'copy cells from sheet1
Dim i As Integer
Sheets("Empty Loc Report").Select
i = 1
'paste copied cells in sheet2
With Range("A1")
If .Cells(1, 1).Value = "" Then
Else
Range(.Cells(1, 1), .End(xlDown)).Copy Destination:=Sheets("Printout").Range("A" & i)
x = x + 1
End If

'print "Printout" sheet print with preview
Sheets("Printout").PrintOut preview:=True

End With

End Sub

it would be nice if someone could help me, if this can be done.

Thank you
A
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top