Just click the Print button, right? In reality, a well-organized and beautifully formatted sheet that looks great on a monitor is often a mess on a printed page. At first sight, printing Excel spreadsheets is super easy. Living in a digital world, we still need a printed copy every now and then.
CARA PRINT ALL SEMUA DATA SPIN BUTTON EXCEL HOW TO
Here we discuss how to use Print Function in Excel VBA along with some practical examples and downloadable excel template.Learn how to print Excel spreadsheets exactly the way you want - print selection, sheet or entire workbook, on one page or multiple pages, with proper page breaks, gridlines, titles, and a lot more.
CARA PRINT ALL SEMUA DATA SPIN BUTTON EXCEL CODE
Step 3: Run this code by hitting F5 directly or manually hitting the Run button on the upper left panel. Step 2: In this, the function “Printpreview” is used.
Step 1: In the VBE, start writing the macro and define the variable name. To explain the Print preview function in VBA, we have used the same data as used in the previous example as follows: This helps us in looking at the data, as to how it will appear at the time of Print, before moving ahead with the execution. In the same way, we have one more function related to Print called Print Preview in VBA. Step 10: We can directly execute by pressing F5 or clicking on the play button.Īs soon as we press the Execution command, the document area is automatically taken to the Printer for Printing.
In case we do not enter the above-mentioned command, the following message displays while execution. Unless we enter this command, the arguments are considered incomplete. Step 10: To end the command we need to enter “End Sub”. But we can customize this option also, if necessary.Ī copies:=1, collate:= True, IgnorePrintAreas:= False End Sub Step 9: We have also mentioned “Ignore print areas” because we have only 1 sheet to print and that is well within the ambit of Print areas. In the above function,Ī copies:=1, collate:= True End Sub By inputting “ Collate _:=True” function we ensure that the data is composed together in the sheet. Step 8: The next argument is “ Collate” function. We can customize it based on a number of copies we need to print. But we can also modify the details like 2 or 3 copies if required. Step 8: After putting the “Printout” option, we select the number of copies in the argument.Ī copies:=1įor instance, in our example, we have mentioned “ Copies=1”. Step 7: Then we have to use “ Printout” option in VBA which appears on the screen. The command “Selected Sheets” denotes that the same data has been copied from the source sheet where data is mentioned. Step 6: The first command is the source data which we have mentioned as Macro1. Step 5: Now let us start writing the code, to do that we need to name the macro first as follows, The subject shall start with command “Sub- Print1 ()” since the information database is taken from Macro1 which we created in Step 2. Step 4: Once we are in VBA we need to insert a module so that we can write code in it. For getting the option on Excel, we need to follow the instruction as follows: Click on Developer’s tab then click on Visual Basic to get into VBA. The Print function can be used in VBA with the help of a Developer option.
Once the Macro is created we can proceed with creating the Print option. In the present case, we have kept the name of our Macros as “ Macro1” which is a default name provided. Select the Data- View-Macros – Record Macro.Īs soon as we put this option, we get the below mentioned screen. Follow the below steps to use the Print function in Excel VBA.