
Tools | Macro | Macros and selecting the “Options” button at the bottom. To assign a shortcut key to your macro selecting
#HOW TO PRINT SELECTED TEXT IN EXCEL CODE#
We already have the End Sub piece of code which was already inserted automatically when we started the Macro. Once the selection has been printed the code ends. Selection.PrintOut Copies:=1, Collate:=True Ending The Code. Be sure to specify how many copied and if you want pages collated if you are printing no The next line of simple code simply takes the user-selected range and send it directly to the printer. Sub printSelection End Sub Printing The Selection. We simply need to enter the rest of the code between these two lines. Notice that Excel will automatically enter the end text End Sub to end the Sub Routine. In this example, I have called it simply PrintSelection.

Do this by selecting the Personal.xlsb workbook, then Insert Module. We need to start off the macro by inserting a New Module. Why Is My Personal Macro Workbook Not Loading Automatically? Starting The Macro. Macro Mondays – Create A Shortcut To Your Personal Excel Macro Workbook Macro Mondays -Creating and Updating Your Personal Macro Workbook If you want to read more about your Excel PMW then check out my blog posts below. Learn More About Your Personal Macro Workbook (PMW) I will create and save this for future use in my Personal Macro Workbook. As you can see this code will be useful to reuse in any workbook. If you store it in the current workbook then use is restricted to that workbook.

If you save you code in your Personal Macro workbook it will be available for use in any of my Excel workbooks. You then have a choice, you can either create a module to store your code either in your Personal Macro Workbook or in your current workbook. Either by hitting ALT +F11 or selecting the Developer Tab | Code Group | Visual Basic. Preparing To Write The Code.įirst, you will need to open the Visual Basic Editor. Good, read on and let’s get writing some simple code. Sound like it would be useful and save time?. No more selecting a print range or going into print options to just the print the selected range. With this small Excel VBA macro, you can. Do you ever wish you could just highlight the selected range of cells in your Excel worksheet, then just print them?. Welcome, Excellers to another macro blog in my #MacroMonday #Excel 2019 series.
