Excel Guides

Editing Macros in Excel

Once you're in the Visual Basic Editor, you'll see a list of all the open workbooks in the Project Explorer window on the left side of the screen. If your workbook isn't listed, you can click the "Add Module" button at the top of the window and then browse for your file. Once you've found your workbook, double-click it to open it in the editor.

On the right side of the screen is the Code window. This is where you'll find the code that makes up your macro. If you recorded a macro, the code will look something like this:

Sub Macro1() ' ' Macro1 Macro ' '     Range("A1:A10").Select     Selection.Copy     Range("B1").Select     ActiveSheet.Paste End Sub

You can edit this code to change what your macro does. For example, if you wanted to copy a range of cells from column A to column C, you could change the code to this:

Sub Macro1() ' ' Macro1 Macro ' '     Range("A1:A10").Select     Selection.Copy     Range("C1").Select     ActiveSheet.Paste  End Sub

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.