You can also right click the selection and click on Copy Highlight ie select

You can also right click the selection and click on

This preview shows page 21 - 31 out of 43 pages.

You can also right-click the selection and click on Copy Highlight (i.e., select) cell C18 Paste the data using CTL+P You can also right-click the selection and click on Paste Highlight (i.e., select) the last column ( K5:K14 ) Copy the selection using CTL+C Highlight (i.e., select) cell F18 Paste using CTL+P Select cell A1 and then press Esc 21
Image of page 21
Macro Example (cont.) Now we are ready to record the macro You can do this in several different ways Select View > Macros > Record Macro… Record Macro button from the Developer Toolbar Click on the Record Macro icon located next to the legend “Ready” on the lower left corner of the workbook 22
Image of page 22
Macro Example (cont.) When the Record Macro dialog box appears, we enter a name for the macro The macro name should begin with a letter and may contain only letters, numbers and the underscore (i.e., _) character Maximum length is 255 characters Do not use special characters (e.g., !, ?, &) or blank spaces Use a short and descriptive name Use _ to separate words First_Macro Capitalization works well too FirstMacro Enter CarCopyPaste as the macro name for this example 23
Image of page 23
Macro Example (cont.) Once you begin recording, notice that the Record Macro button is now the Stop Recording button After finishing the steps needed to copy and paste the information, you can stop recording Select View > Macros > Stop Recording Click on the Stop Recording button from the Developer Toolbar There is also a Stop button on the lower left corner of the workbook Click on the square button next to the legend “Ready” 24
Image of page 24
Saving Excel Files Containing Macros When a normal workbook (i.e., one without macros) is saved, MS Excel appends the standard . xlsx extension For workbooks containing macros, the file must be saved as a Macro-Enabled file In this case, Excel appends the special extension . x lsm to these files If you fail to save a file containing macros with the .xlsm extension, ALL YOUR WORK WILL BE LOST! 25
Image of page 25
Macro Security Macro security is an important feature since MS Excel 2007 Because macros may be used to harm your computer The level of protection can be set directly from the Developer ribbon by selecting Macro Security 26
Image of page 26
Macro Security (cont.) When you open a spreadsheet that contains macros, Excel displays a warning on the ribbon alerting you that macros have been disabled Select Enable Contentonly if you are sure the file is safe 27
Image of page 27
Macro Security (cont.) To avoid having to authorize every spreadsheet with macros that is opened, define your working directory as a trusted location 28
Image of page 28
Macro Security (cont.) Save your file in the trusted location that you just defined Make sure to save it as fileName.xlsm Remember If you save your file with the extension .xlsx, all you macros will be lost! 29
Image of page 29
Running the Macro Once you have recorded a macro, you can run it to ensure it works correctly Select View > Macros > View Macros Select macro “CarCopyPaste” from list and press R un Press button Macros on the Developer Toolbar Select macro “CarCopyPaste” from list and press R un 30
Image of page 30
Image of page 31

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture