Macros & VBA Training Series Part 3:

How to Create a Userform to Export Worksheets

Double-click video to view in Full Screen HD.

Download the file used in this video:

The Exports Sheets Userform.xlsm (216.4 KB)

Bonus: How to Export The Selected Items Only

In this video I explain how to set the listbox multiselect property to allow the user to select multiple items. We then add code to the Export button’s Click event to only export the selected sheets. We do this with an IF statement.

Macros & VBA Training Series

Video 1

Intro to VBA:
Writing Your First Macro

Video 2

Automating Tasks:
The Summary Report

Video 3

Userforms:
The Exports Sheets App

How features can we add to the userform?

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

Click Here to Leave a Comment Below 126 comments
Augusto Donoso - July 11, 2018

HI Jon! Tks for the very well explained video. I am a Mac user so I wanna ask you a question.

1. How can I open a file directly from the user form using your example.

w/regards

Reply
Karl - July 8, 2018

Jon,

Well done. Thanks.

I would like to create a tool that enables (anyone who uses it) to create a Manifest file that would be used to upload a course to a Learning Management System (LMS). The file would be XML, thus would have to be able to use a combination of variables, formulas, loops, and special characters.

Imagine a document that the Course Designer would have filled out items such as:
* Course Title
* Course Description
* Course Chapters
* Course Lessons Title
* Course Lesson Filenames
* Course Objectives

Then once it’s all filled out, the automation creates the manifest file based upon the collected information above. Part of the file would look like:

—— sample excerpt ——-

[Lesson Title]

—— sample excerpt ——-

Then when it’s all finished, it saves the file as a text-based file with the .XML extension.

NOTE:
* No two courses would look alike.
* Some courses may only have 1 chapter and (let’s say) 3 lessons. Whereas other courses may have 5 chapters and 25 lessons.

I’ve got a lot to think about, but I’d be curious if you had any thoughts about this idea.

Reply
D Van Camp - June 28, 2018

In this 3rd video, twice the ‘hint’ came up (once for .SaveAs and once for .Close) there was an enclosing set of parentheses around the parameters but you did not include them. I would have automatically typed “(” to begin the parameters. Why didn’t you need them? (I’m OCD 😉

BTW, I have gotten quite a lot out of these three videos! Keep up the good work!

Reply
Rafid - June 5, 2018

Thank you so much for your fantastic training

Reply
Alain de Coriolis - June 3, 2018

Hi John,

Thank you for the easy to follow Intro to Excel Macros structure and tools. I have automated over time many Business Tasks with Lotus 123 and Excel Macros by using as you suggested the Macro Record to obtain the various steps in code format and then assembled the whole thing and polish it.

Looking forward to what ‘s coming next.

Thanking You

Alain de Coriolis

Reply
Louanne - April 18, 2018

This is very interesting. Looking forward to the VBA Pro Course

Reply
Wouter - April 11, 2018

This is ridiculously cool. Every time you think you have a pretty full understanding of Excel’s functions, something new and amazing shows up. Thanks very much for the video!!

Reply
Simona Duball - March 31, 2018

This website is completely gret. I’ve researched these stuffs a great deal and I
realised that is professional, easy to comprehend. I congratulate you because of this research that I’ll recommend to the people friends.
I ask you to visit the gpa-calculator.co
page where each scholar or scholar can calculate ratings grade point average
marks. All good!

Reply
Steve - March 7, 2018

Hi Jon,

I missed the last course enrolment.

Can you tell me when your next pro VBA course will start?

In the Pro VBA course is there any help with plotting complicated equations from within VBA into a worksheet leaving the calculation in VBA rather the worksheet?

Many thanks

Steve

Reply
Joel - January 19, 2018

Hey Jon,
I would be interested in creating VBA as shown in your videos. My concern would be that once I create the VBA code I would like to take this VBA improvements to my work computer and have it available for all of my excel work both at work and home. Since I am creating the VBA inside a workbook how can I store it on my computer and then take it to work with me (or visa versa). I would like to keep all the VBA macros in a folder on the excel toolbar to make them easy to access with the touch of a icon. If you can explain this concept it would be appreciated.

Reply
    Jon Acampora - January 22, 2018

    Hey Joel,

    Great question! You could store the file on a cloud drive like Dropbox, Google Drive, or OneDrive. Then access it on any computer that is connected to that drive. I use all of these services and they each allow you to store files in folders on your computer. The folders look like regular folders and they sync whenever you make changes or add/delete files. It’s the easiest way to access files between computers and keep things synced.

    I hope that helps.

    Reply
Mountaga - January 19, 2018

Hello I wrote back the following in response of an email I received from you Sir Jon. I hope you will read it and respond back as quickly as possible:

“Hello Sir Jon,

I am very interrested about the offer and want to make 3 payements of 99$. But I have never done an online transaction before. I don’t have a mastercard or a paypal card. How can I manage to get you have the money. Because I really want to start the course at the very beginning so that I won’t miss anything. What can I do before it’s too late ?

Thanks and looking forward your response.

NB: I live in Sénégal, a west African country across the Atlantic Ocean. Our currency here is “Franc CFA” (XOF is the code used)”

Reply
Albert Mascarenhas - November 10, 2017

Yours videos were clear and concise and well presented. Thanks John and I look forwards to your VBA pro course.

Reply
Gretchen - November 4, 2017

I’m using Excel 2010…and lesson 3 doesn’t work but doesn’t give me an error. I am able to initialize the Userform but that is all.

Is it my version of excel?

Thank you

Reply
Luuk - November 3, 2017

Nice, I have always wanted to use a form but where afraid to try it. Now I will, thanks!

Reply
Burdette - October 10, 2017

Super! Excel is all about saving time and improving accuracy. These Macros showed a way to do both. I can envision a future versions of Excel having some of these functions built into Excel itself.

Reply
JP - September 13, 2017

Excellent material. Love it

Reply
Satyajit Roychaudhury - August 30, 2017

Excellent video. Very useful.

Reply
Agnes - August 14, 2017

Really good. Please do some more series. I would love to see some more topics on automation i.e. Get and Transform data to read in spreadsheets and ways to email and save results.
Thank you.
Agnes

Reply
Paul - June 17, 2017

Thanks Jon! Your lessons are presented in clear, easy to understand modules. I would recommend your training to anyone wanting to learn VBA.

Reply
asim siddiq - April 16, 2017

Jon Acampora, your are a Great Teacher!

Reply
Scott H. - April 13, 2017

Great teaching!

Reply
Catherine - March 13, 2017

Great training video, wish I knew about these courses sooner.

Reply
Ken - March 6, 2017

Thanks Jon, this is great stuff! Especially for someone who was scarred by their computer science professors in their college days. I am looking forward to the info on the Pro Course.

Thank you!

Ken

Reply
Jess - February 21, 2017

Jon,

Another Great Presentation! I received an error when I ran my code but it ran fine once I made sure none of my sheets were hidden. Go figure! Anyway, thanks and awaiting your email regarding the pro series. It will be nice to use loops in vba than writing long formulas in excel.

Jess

Reply
    Jon Acampora - February 28, 2017

    Hi Jess,
    Yes, I think I forgot to mention that the sheets will need to be visible in this case. We can also add code to unhide and then hide sheets if the macro needs them to be visible. Not all code for a sheet requires the sheet to be visible.
    I look forward to having you join us for The VBA Pro Course. Thanks again! 🙂

    Reply
Joan - February 16, 2017

So nice video. I want to learn more about VBA. Thank you very much!

Reply
Damiano - February 10, 2017

Hi Jon, your videos are very useful and well explained: a simple and easy way to learn VBA. I’d like to have more info about the VBA Pro Course. Thanks

Reply
    Jon Acampora - February 15, 2017

    Thank you Damiano! I really appreciate the nice feedback. I sent you an email with more info on the course. I look forward to having you join us.

    Reply
Kristina - February 7, 2017

I tried this on a monthly report I sent out. when I got the to ME.

Listbox was not an option, and it keeps giving me an error. I don’t know how to get LISTBOX to show in my choices under ME.

Any helP?

Reply
    Jess - February 21, 2017

    Kristina,

    Did you rename your listbox object to ListBox_Sheets? I think me. refers to the userform and ListBox_Sheets has to be an object on the userform for it to appear in the drop-down.

    Jess

    Reply
kapil - December 27, 2016

Hi John, I want to export data from a workbook.

Like if i am having region data East 1 est 2….. west 2
i want to export it in east 1 sheet… west 1 sheet..

Also i want to learn more. what’s your fee and how can i get video.. please let me know

Thanks
Kapil

Reply
    Jon Acampora - December 27, 2016

    Hi Kapil,
    Great question. That is a very common task to split data into sheets within the workbook.

    I will be sending you more info about the VBA Pro Course in just a few days. Stay tuned.

    Reply
Miera - November 13, 2016

Hi Jon,
I am very greatful and delighted of your effort and expertise in excel. I’m a beginner and benefiting greatly from your simply but very indept tutorials.

Thanks again.

PS: cant wait for your VBA Pro course.

Reply
    Jon Acampora - November 14, 2016

    Thank you Miera! I look forward to having you join us.

    Reply
Bernardo moniz da Maia - November 9, 2016

thank you for the explanation. very useful.
i will wait for or next emails regarding the beginner to pro.
best regards

Reply
Baliong - November 1, 2016

Thanks John for the Links, I’m still learning and its becoming very interesting, as I do project monitoring and evaluation in my daily work and I look after HIV – AIDS patient database so I’m working on a userform that can help enter data, store data and export data to word or PDF to report to my bosses, I’m still working on it. Every thing was done on assumptions I did not really understand the basic things about macros and VBA code deveopment but I’ve been searching all over the web to see what people have done and try applying for my self thanks alot again John.

Reply
Baliong Erewiong - October 31, 2016

I appreciate your efforts, its very helpful on my end because I’m just a begginer and I do project monitoring and Evaluation so I’m beggining to see the importance of excel and VBA

Reply
    Jon Acampora - November 1, 2016

    Thanks Baliong! I’m happy to hear it helped.

    Reply
Don Willhoit - October 12, 2016

Great 3 video intro! Can’t wait for the full course. Thanks.

Reply
    Jon Acampora - October 22, 2016

    Thank you Don! I really appreciate your support!

    Reply
Victor - October 2, 2016

Extremely well explained. Thank you very much!

Best Regards,
Victor

Reply
Rajan A - August 30, 2016

Hello Jon,
Wonderful explanation. Video in all respects is great.
Request to mail me details of your wonder full learning modules.
Thanks and regards,
Rajan

Reply
YasserKhalil - August 25, 2016

You are a great teacher John. Really wonderful presentation
I am admired of your website

Reply

Leave a Reply: