Q&A for How to Write a Simple Macro in Microsoft Excel

Return to Full Article

Search
Add New Question
  • Question
    If I have two lines of dates in one cell, how do I delete the first line?
    Community Answer
    Community Answer
    Double click on the cell, or click the cell and then F2. Then, delete the part that you don't need. If you want to do this on a large number of cells on the same column, then select the column, click "DATA" on the top menu, click on "Text to Columns," and try the different options to divide the data there. (There are too many to list here.) You can divide by commas, spaces, dashes, periods, etc., or specify the length. Make sure the columns on the right are empty; the divided data will split into those columns.
  • Question
    While recording a macro, will it record something I want done outside of Excel, such as opening up a website and clicking on things in that website?
    Community Answer
    Community Answer
    No. The macro program in Excel is limited to Excel. Once you use an outside program, Excel will be unable to record what you are doing.
  • Question
    How do I secure files in Excel?
    Community Answer
    Community Answer
    Click the Microsoft Office button, point to Prepare, and then click Encrypt Document. In the Password box, type a password, and then click OK. In the Reenter Password box, type the password again, and then click OK. To save the password, save the file.
  • Question
    How do I write a micro to clear out cells?
    Community Answer
    Community Answer
    First, open an excel working book. Then enter data on Sheet 1 at A1:C10. Press Alt+F10 to open VBA Editor. Insert a module for insert menu. Copy the above code and paste in the code window. Save the file as a macro enabled working and press F5 to run it.
  • Question
    What do I do if my macros are disabled in MS Excel?
    Community Answer
    Community Answer
    If you are using a PC from work, that may be a safety feature from your IT department to prevent malicious code from affecting your PC or your network, and only they can modify it. I'd recommend getting in touch with the IT department first.
  • Question
    How do I write a macro so that instead of the macro going to a specific cell it needs to go to a blank cell in a specific column?
    Community Answer
    Community Answer
    Recorded macro may not capture logic to identify the blank cells as it capture all cursor movements and may end up selecting the specific cells only. However we may amend the part of code to get the desired result. In the above code we may replace ActiveCell with Range("C65000").End(xlUp).Offset(1, 0) to get such result. Range("C65000").End(xlUp).Offset(1, 0) will be interpreted by the macro recorder as below: 1. Place the cursor on “C65000” assuming we wouldn’t have data beyond that point. 2. then moves upward as we would expect by Ctrl + Home and select the last filled row in that column. 3. and finally offset one row down to find the next available row.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit

Return to Full Article

You Might Also Like

Use Macros in ExcelExcel Macros: How to Run, Record, and Use Macros in Excel
Automate Reports in ExcelAutomate Reports in Excel
View Macros in ExcelView Macros in Excel
Create a Custom Macro Button in ExcelCreate a Custom Macro Button in Excel
Add Rows in Excel with a FormulaAdd Rows in Excel with a Formula
Create a Form in a Spreadsheet Create a Form in Excel: Step-by-Step Guide
Remove a Macro in ExcelRemove a Macro in Excel
Edit Data in Microsoft Excel3 Simple Ways to Edit Data in MS Excel
Insert Rows in Excel Using a Shortcut on PC or Mac3 Quickest Ways to Insert Rows in an Excel Spreadsheet
Use Google Spreadsheets Use Google Sheets: The Ultimate Guide for Getting Started
Add a New Tab in Excel Add a New Tab in Microsoft Excel: Your Ultimate Guide
Create a User Defined Function in Microsoft Excel Create a User Defined Function in Excel
Make a Spreadsheet in ExcelMake a Spreadsheet in Excel
Use ExcelNew to Excel? Here's Super Easy Tricks to Get You Started