VBA Training Series – How to Write Your First Macro (Part 1 of 3)

Macros & VBA Training Series Part 1:

Writing Your First Macro & The Excel Object Model

Double-click video to view in Full Screen HD.

Download the file used in this video:

My First Macro.xslm (93.0 KB)

Macros & VBA Training Series
Enroll for FREE

The video above is the first in a 3-part training series. Can I send you the next two videos?

Please click the link below to enroll in the free training. I will send you video #2 in just a few days.​

Video 1

Intro to VBA:
Writing Your First Macro

Video 2

Automating Tasks:
The Summary Report

Video 3

Userforms:
The Exports Sheets App

Please click the big green button above to register for the free training series.

About Me

Welcome to Excel Campus!  I am excited you are here!

My name is Jon Acampora and my goal is to help you learn Excel to save time with your job and advance in your career.  I've been an avid Excel user and VBA developer for 10+ years.  I am also a Microsoft MVP.  When I'm not looking at spreadsheets, I get outdoors and surf. 🙂

What Process Do You Want To Automate in Excel?

Please leave a comment below with your answer, and any questions.  Thanks!​

1,548 comments

Your email address will not be published. Required fields are marked *

  • I am using an excel workbook for the family budget. The budget is setup and I am trying to find a way to import information from the creditors. The creditors have the capability of generating a “csv” file. This file contains the following information:
    Vendor, Cost, & date of sale.
    Those columns are not necessarily in that order, so I need to match words for a specific location (column)

  • Really clear easy explanation.I would like to match data .Say I have a list of names on one sheet in a workbook and in another workbook I have the name and the email fir that name.Can a macro be done to match the name in on worksheet to another and once matched copy some required values. It something that I am doing via cut and paste…..gets really time consuming

  • I’m the voluntary CFO for a family cacao chocolate manufacturing company. I have created a lot of manual excel files to help standardise and record all facets of the manufacturing process: lot code generator, sales, cacao bulk production, raw ingredients & costing per product, break even point etc etc.

    All these, and more, have taken lots and lots of time to accomplish. I cannot win the time back, but I would enjoy trying to automate some of the above by using VBA. I have started one (for recording Cacao Bulk Inventory), but I realise I need to learn some basics…..

    I have time on my hands as I’m retired…so would love to learn.

  • Thank you! Generally, I want to learn how to edit my Macros & understand what’s behind them.
    Also, I sum columns of data all the time – the columns are always of different sizes – and I want to automatically format after summing. I’ve googled the answer but for something so commonly done, it doesn’t seem like an easy solution. I’d like to get myself a little keyboard short-cut for that so I could use it all the time.

  • I want to write a macro that will add information typed spreadsheet and print an invoice then save it using its number (comes sequentially from previous one), then waits for the next data to be typed in

  • I want to take a spreadsheet I’ve created and use it to populate a form. I’ve done a mail merge with Word for this purpose, but the form is Excel based so it looks like a macro will make more sense. (I wish there was a mail merge function in Excel for the purpose, actually).

  • Iam only know to Entering data only in excel sheet. Exolain me to formatting data, insert pictures,charts etc

  • I want to copy values from certain columns based on a condition into a different sheet already having those columns and some previous data. So I want the old data to be replaced with the new data.

  • Great video! I have been handed the task of accumulating 63 individual time cards into a master report for our payroll service. The master sheet will have a mix of time reports and commissions.

  • I have a voluminous report that is filtered, I want to add cells, calculate a unit cost, show an amount when my if statement is satisfied, eliminate records when no value is in the line, then compute an allowance for those records with a value. then move those records to a new sheet, total by a break in the item number, write a line with the totals only and then print the entire listing.

  • Everything from creating a button to select all data on a worksheet and adding a data filter, to adding 0’s to blank fields in a spreadsheet to be able to use in pivot tables.

  • Use VBA to Copy the Data Entered Via an Input “Form” in Excel & Pasted Into Another “Data” Worksheet Within the Same Workbook That the Form is in. I Have Several Rows of of Data that need to be copied and pasted into separate rows in the Data Worksheet. I Need the First Row to Copy & Paste and Then I Need the Next Row to Copy & Paste Below That First Row and So On. Sort of a Loop is Needed. Enjoyed Your Video #1 and Looking Forward to Video #2 & 3. Thanks so Much! K

  • The introduction was quite helpful.

    I work with a lot of pre-built Macros; At times it can be difficult to understand exactly what the VBA code is actually saying. This puts things in much better perspective in how VBA is working.

    Eventually, I want to go through some of the Data used to look for trends and automate many of the processes in create yet simple ways

  • I want to automate the transfer of identical share trading stock on hand reports from 5 different access databases, into a single excel workbook, and then sort the report by stock code with subtotals on each stock. At the moment this takes 3 hours each time it is done with the majority of the time spent in formatting the final report.

  • I have taken on a new role as a Business Process Analyst. This was a career change from a Production Planning Supervisor. I have fumbled through some VBA programming to create some templates to automate some repeatable reporting. I created some cool stuff by trial and error of copy/pasting codes from the internet; however, can’t necessarily explain how/why it works….which makes troubleshooting very hard and also takes me a lot longer to work on projects than I need to. I feel understanding it better will help me be more efficient.

  • Hi Jon,

    Thanks for the introduction. I’m very new to using excel but already super excited about how this is going to change my life for the better! Excel is my new best friend and I can’t believe how much it can do to keep you organized. I’ve been working on building my first organization spreadsheet and so far so good. I’m want to learn how to build a macro that will move completed tasks from one worksheet to another so I can keep my organization chart clean. I want to assign the macro to a button so I can trigger the method. I’m eager to look over more of your material and find out what other learning material and I should purchase. I just found your youtube channel today so hopefully all my questions will be answered in time. Thanks again.

  • Video one was very helpful. Thank you.

    I am attempting to write a VBA macro to copy one column of cells to another within the same worksheet as values. The difficult part is that I want to make the offset variable based on a cell value. We create monthly SOVs for pay applications. I am trying to assist in rolling the spreadsheet forward every month.

  • there are multiple reports that I am creating daily using excel and SNOW. how do I automate them so that I can save my time.

    The DATA is extracted from SNOW and then is edited in excel.

  • Thanks Jon, Video 1 was very helpful. I am a intermediate Excel user and I am at the stage were I need to get familiar with VBA and this has given me the motivation to learn more.

  • This series should be very useful for me to learn from a step-by-step process on what is VBA, how to use it and the skills in writing commands. Thank you for the excellent tutorials.

    May i know why i can’t proceed to video 1 after typing my email? And i didn’t receive email as well?

    Thanks.

  • Great video. Simplicity of delivery caught me there. I cant wait to see parts 2 and 3. Thanks in advance for making them available.

  • I’m looking to make clickable references in the first column on a report that generates a new worksheet like you would in html.
    It would make order viewing easy at my workplace and you could just click in and see what order without using a huge query that takes forever to run.

  • Hi Thanks for the video. I’m searching for generating a product registry from another sheet entries. I have already done to fetch the single entries like invoice numbers, customer names etc but could not fetch each products line items. It’s fetching only the last line item only leaving other lines as blank. Could you help me on this or anything similar codes / videos available

  • Hi there and thank you so much. I am trying to help a lady at work who creates a Meal Planner for 7 days a week and does it all manually. I have some parts completed but my lack of VBA and programming knowledge is letting me down.

    I can send my spreadsheet but I am sure you have more important things to do.

    Regards,

    Les

  • Hi. I keep getting an error called OLE error when I am working on few heavy excel sheets. Would you to be kind to share what could be the solution for this issue?

    Thanks,
    Shweta

  • The video was very useful and promising. I hope to work on making my own macros to help expedite my calculations. Thanks

  • Hi,
    i have calculation table wherein i enter the data and run calculations. Whenever new data is entered and calculations run, the old results gets overwritten. I wanted to transfer that results of every run to some other cell/worksheet and form a table of the results.

  • Thank you Jon. The first video was very promising. I have watched other videos and read books on the subject at a very rudimentary level so far but your explanations were very clear and hopefully will continue to be so in the other videos too! thanks again. I hope eventually to be able to write codes that will copy certain information from one sheet in a different layout (say from rows to columns) into another sheet to summarise and collate the data and perform some actions on them. I don’t know how feasible this will be for me but we’ll see.
    Thanks.

  • Hi Jon –

    I would like to copy and paste a series or range of numbers from one workbook into another. Each one of the numbers from the first workbook to be pasted into 27 rows of the other and then repeated with the next number down in the range from the first workbook into the next 27 rows in the second (basically cell B2:B28 then B29:B56 and so on. I have 500 numbers in the first to be copied into 13,500 rows of the second. It is gobbling up my time to copy and paste all of these! Help!

  • I am trying to copy and paste some rows and columns from one worksheet to another. It is for sales data so the titles of each will stay the same it will only then need me to input the data for each one every week.

  • I had no experience with macro in excel and your video’s are helping me to understand what is happening.

  • I have a report (of varying length), and I need to create a tab for each item on the report, add a standard template to each tab, and fill it in using the data from the report to complete it.