how to create custom report specially for printing

Arebrahimi

New Member
Joined
Dec 26, 2023
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
For example, our table contains 5 fields or titles and we have ten rows of records. Now, we want only one record to appear in front of the titles of each field in the report, in addition to the format of the page and the arrangement of the fields in the report by ourselves. Let's make it so that it is not clear in this output that it was an Excel page.
As an example, we put the main table in the first image and the output printout in the second attached image
 

Attachments

  • main page.jpg
    main page.jpg
    115 KB · Views: 4
  • print or file output.jpg
    print or file output.jpg
    32.9 KB · Views: 4

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi @Arebrahimi.
On the sheet where you have the list (in my case it is Sheet1) select any cell. Then run the following code:
VBA Code:
Option Explicit

Sub Transfer()
    Dim i           As Long

    Dim sh1         As Worksheet
    Set sh1 = ThisWorkbook.Worksheets("Sheet1")

    Dim sh2         As Worksheet
    Set sh2 = ThisWorkbook.Worksheets("Sheet2")

    Dim Rw          As Long
    Rw = ActiveCell.Row

    Dim invArr      As Variant
    invArr = Array("C8", "E6", "C6", "E4", "C4")

    For i = LBound(invArr) To UBound(invArr)
        sh2.Range(invArr(i)).Value = sh1.Cells(Rw, UBound(invArr) - i + 1).Value
    Next i

End Sub
how to create custom report specially for printing_v1.png
how to create custom report specially for printing_v2.png

and on Sheet2 in the specified cells we get the desired result. For clarity I have attached screenshots. Change the names of the worksheets to your own. I was glad to help you. Good luck.
 
Upvote 0

Forum statistics

Threads
1,223,927
Messages
6,175,438
Members
452,641
Latest member
Arcaila

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