How To Import A .bas File In Excel For Mac

How To Import A .bas File In Excel For Mac Average ratng: 5,6/10 3874 votes

Related Articles

However I want to know if there is a way of executing the macro without opening the original excel spreadsheet. I know that I can export the macro as a.bas file. However I don't know of how to execute this.bas file or the macro in any other excel spreadsheet. Any help would be greatly appreciated. Thanks, Anshul. Dec 18, 2017  You can easily concatenate the text files together from the command prompt on Windows (instructions for a Mac are in the article linked below). Create a folder for the text files to be merged and copy/paste all of them into it 2. Now, open a co.

  • 1 Allow Excel Macros to Run at Startup
  • 2 Run VBA in Excel
  • 3 Activate Macros in Excel
  • 4 Show a List of Values in a Cell in Excel

Macros can help you save precious time while performing repetitive tasks for your business in Microsoft Excel. Suppose, for example, that you want to change the color of spreadsheet cells to red if their values exceed 1000. Doing that by hand might take a while, but an Excel macro can perform that task at the click of a button. If you don't want to write the Visual Basic code needed to create a macro, you can import a macro that someone else coded into your spreadsheet.

Add Developer Tab

1.

Launch Microsoft Excel and open a spreadsheet containing a macro that you want to import into another spreadsheet. Atheros l1e lan drivers for mac windows 10.

2.

Skip to the next section if you see the Developer tab on the Excel ribbon; if not, click 'File' and then click 'Options.'

3.

Click 'Customize Ribbon' and move to the 'Main Tabs' box, which contains a list of tabs to connect to Excel.

4.

Place a check mark next to 'Developer' and click 'OK' to add the Developer tab to the ribbon.

Enable Macro Security

1.

Click the 'Developer' tab, then click 'Macro Security' to view the Trust Center window that contains security settings.

2.

Click the 'Enable all macros (not recommended, potentially dangerous code can run)' radio button to select it. Selecting this option allows you to enable all macros in the worksheet temporarily.

3.

Click 'OK' to close the Trust Center window and return to the main Excel window containing your spreadsheet.

Import Macro Code Into Another Spreadsheet

1.

Click the 'Developer' tab and then click the 'Macros' button. Excel displays the Macro dialog window that contains a list of the spreadsheet's macros.

2.

Click on the macro you want to import into another spreadsheet, and then click 'Edit' to open the Visual Basic Editor. A Project window containing a list of modules appears on the left; a Code window containing the macro's VBA code appears on the right.

3.

Click inside the Code window and press 'Ctrl-A' to select the window's code. Press 'Ctrl-C' to copy that code to your Windows clipboard.

4.

Press 'Alt-Q' to close the Visual Basic Editor and return to your spreadsheet in the main Excel window.

5.

Open the worksheet into which you want to import the macro code you copied. Click the 'Developer' tab, then click the 'Visual Basic' button to open the Visual Basic Editor.

6.

Click 'Insert' and select 'Module.' The editor creates a new module that contains your macro as well as a new Code window that is blank. Right-click inside that window and press 'Ctrl-V' to paste the code you copied from the other spreadsheet into the Code window.

7.How To Import A .bas File In Excel For Mac

Press “Alt-Q” to close the Visual Basic Editor window and return to the main Excel window. Click the 'Macros' button to open the Macros dialog window. You will see the new macro that you imported in the list of macros. Click that macro and then click 'Run' if you want to run and test the macro.

Tips

  • To save the spreadsheet with the macro you imported, click 'File' and 'Save As' to open the Save As dialog window. Click the 'Save As Type' drop-down menu and select “Excel Macro-Enabled Workbook (*.xlsm)” as the document file type before clicking 'Save.' You must save Excel documents in this format if they contain macros that you want to run later.
  • Microsoft suggests returning to the Trust Center window and clicking the “Enable all macros (not recommended, potentially dangerous code can run)” radio button to unselect it and after importing your macro code. Doing this will help protect your computer by preventing macros from running automatically. This could happen, for instance, if you download a spreadsheet from an unknown source that contains a malicious Excel macro.
  • You can also share a macro by emailing it to others or posting it on the Web. People can follow the steps you used to import the macro code into their spreadsheets.

References (2)

Resources (2)

About the Author

After majoring in physics, Kevin Lee began writing professionally in 1989 when, as a software developer, he also created technical articles for the Johnson Space Center. Today this urban Texas cowboy continues to crank out high-quality software as well as non-technical articles covering a multitude of diverse topics ranging from gaming to current affairs.

Photo Credits

  • Polka Dot Images/Polka Dot/Getty Images
Cite this Article
Choose Citation Style
Lee, Kevin. 'How to Import Macros for Excel.' Small Business - Chron.com, http://smallbusiness.chron.com/import-macros-excel-54777.html. Accessed 09 March 2020.
Lee, Kevin. (n.d.). How to Import Macros for Excel. Small Business - Chron.com. Retrieved from http://smallbusiness.chron.com/import-macros-excel-54777.html
Lee, Kevin. 'How to Import Macros for Excel' accessed March 09, 2020. http://smallbusiness.chron.com/import-macros-excel-54777.html
Note: Depending on which text editor you're pasting into, you might have to add the italics to the site name.