An important advantage of VBA over Python is that user can "record" their actions and Excel will "translate" it to Macros. So user needs not build it from scratch. User needs only a bit VBA knowledge and it's sufficient enough to run it from time to time. May not sound nice to hear, but it is really a nice feature when beginners are making their applications.
@abexlconsulting95573 жыл бұрын
You are more than correct.
@morgadoapi44313 жыл бұрын
Another advantage of VBA and Python is that you should not touch these, at all, ever.
@abexlconsulting95573 жыл бұрын
@@morgadoapi4431 why?
@luvlycan3 жыл бұрын
I'm working as VBA developer since last 4 years and honestly I'm feeling that now this language is becoming obsolete. :(
@morgadoapi44313 жыл бұрын
@@luvlycan I would even say it's obsolete since 6 years.
@logic36863 жыл бұрын
I've already created so many functions/sub routines in VBA that keeps me from writing out common code that writing new subs in my workbooks is pretty simple. Plus I work in an environment where the big factor of installing python on end users computers that use my workbooks is just not reasonable for me. So no, the convenience of VBA being already part of an excel workbook I'm sharing that the user doesn't have to install a 3rd party to use is a big factor for me.
@Excelmacromastery3 жыл бұрын
Thanks for sharing! That is a factor for many people.
@rushrush67543 жыл бұрын
Your right, python is powerful in data Analytic but can't be compared with vba that was built specifically for Microsoft software. vba is obviously more powerful in excel again python cannot replace it completely
@htchd02113 жыл бұрын
@@rushrush6754 Same here.
@wisetank1353 жыл бұрын
@@Excelmacromastery is Microsoft releasing a MS version of python like script code in excel?
@josipsuflaj83713 жыл бұрын
@@wisetank135 It seems to me Microsoft is trying to push all to the cloud. M365.No Vba there, not sure about python. All hype about power apps, power automate and powerFX as underlying logic facilitator. On the other hand it is still very 'raw' and more bot, teams orientated Just my impression. Big companies will be 'nudged' there. Nevermind 'success' of sharepoint that tried that few years ago
@dimonovych3 жыл бұрын
1. You can write your own function in VBA and call it with "one line of code only" 2. There are extensions for VBE for additional functionality, such as grouping parts of code. 3. There is also spell check in VBE, it makes spaces after commas automatically) I don't say Python is bad, but those advantages didn't argue me)
@pabloraindogarcia81072 жыл бұрын
Exactlty!! X2
@JHatLpool2 жыл бұрын
The big advantage of Excel (+ VBA) is that it is just everywhere. With VBA, you can get started quickly and make a quick assessment of time to be spent/ importance of your proposed application. VBA and Python will live side-by-side for a few years to come.
@michaels1813 Жыл бұрын
No need to install additional tools. I can be sitting in a meeting and start to code.
@PiroMat153 жыл бұрын
"Company program restrictions..." That's how my adventure with VBA begins :) And it's great due to easy installation or "no installation needend".
@mzucs3 жыл бұрын
Same here
@joseryanquiatchon73303 жыл бұрын
Exactly. Develop and throw away
@_Dearex_3 жыл бұрын
This
@lianvitos3 жыл бұрын
So true. I work in a worldwide operating company and they allow no extra software here. Even Visual studio is forbidden, I have checked today. If you request an exception, you are personally responsible for the security of the software. I will never sign that.
@petrmercedes18683 жыл бұрын
unfortunately also.
@CodingIsFun3 жыл бұрын
Great video, as always! Totally agree with your points. I personally like to use VBA & Python depending on the use case. When it comes to deploying solutions to co-workers, I usually prefer VBA. The conversion from a Python File to a standalone executable can sometimes be a solution. Yet, in a corporate environment, mailing .exe is often not allowed.
@Excelmacromastery3 жыл бұрын
Thanks for sharing your experience.
@daviddeclercq99983 жыл бұрын
Yes but you can put the executable on a shared drive and run it from there
@PeterGeras3 жыл бұрын
My company blocks mailing .exe as well, so I get around it by zipping the file, then zipping the zip with a password. If the mailing server can't see the contents then it allows it through.
@macedoniojr3 жыл бұрын
@@PeterGeras cool tip!!!
@laravelisbullschitt32813 жыл бұрын
Most end users are not allowed to install software. Only approved software may be loaded onto machines, usually there is a committee that approves the software that gets on the machines....and it can take YYEEAARRSS for anything to get approved....there are some companies I know who still maintain everyone should be using IE and Chrome / Edge is completely banned. These companies are few and far between now but it is usually the case the larger the company, the slower change will be. The only thing that looks poised to kill VBA is the adoption rate of teams based Office 365 thanks to the fludemic.
@roathkanel2 жыл бұрын
I am happy to learn python to extend my knowledge but I am still in love with VBA, VB6 and VB.Net.
@fischziege3 жыл бұрын
Corporate desk slave here: our part time student team member likes to work in Python and his results are great. We as an organisation rely on basic office tools, so deploying solutions as Python scripts or apps is cumbersome and we lack people who can support it. Would love to see Python being integrated in Office, would get me off my lazy behind and learn some more...
@jvdb55093 жыл бұрын
This is the single reason VBA is still so widely used. I develop in VBA for this exact reason.
@johnwayne80593 жыл бұрын
Rather I want to see python integrated everywhere, not only in office products, just BTW! You should kill your lazyness and start as soon as possible with python, caused by python is an allrounder. It's amazingly powerful and can be used for AI as well! Beste Grüße 🤟😎
@biskutnation2 жыл бұрын
Office script will be available as an alternative.
@adastraperlana2 жыл бұрын
@@biskutnation 2 words. Monthly billings. Honesty if i were to start a business I would seek of a way to to it exclusively with open-source. If the company gets big, private software will cost you millions per month.
@Thunderin113 жыл бұрын
Very interesting video. But... As a VBA die-hard who has been making a living out of it for almost two decades, I have to shout out loud that VBA is here to stay! Maybe Python has some advantages when it comes to analyzing data but VBA is used for much more than analyzing data. It is used most commonly to automate Excel and other Office software. It was not referenced in the video how easy / useful it is for Python to automate Excel environment objects for instance (e.g. charts, shapes, pivot tables and list objects). This debate "Will Python Kill VBA" reminds me how in Excel forums between 2010 to 2012 people strongly argued that Excel would disappear soon because Google Sheets is potentially a much more superior product to Excel. Well reality proved it otherwise. Today Excel is by far the most superior spreadsheet product without any competition whatsoever in sight.
@alfredoprime54953 жыл бұрын
I agree completely. Data analysis is secondary for what we use Excel at work. Charts, pivot tables, regular tables, userforms, custom functions, events,... the list goes on.
@MrAbrandao3 жыл бұрын
I use Excel VBA to automate web pages. But now I am stuck with the dead of Internet Explorer....
@TheStenius3 жыл бұрын
We all know it: in most companies, you are considered the (only) „Excel-freak“ in the team if you mention your VBA-skills. Some people even still don‘t know what VBA is. My Boss, Professor/Director of a big science institute, never heard if it. That are the people you have to design your xlsm-files for in many cases. For some of them, it‘s a challenge to make those small adjustments on their Excel to run all of those files. Now we shall ask them to set their systems up to enable Python-code in Excel? Haha, good joke. I would change right away, if MS would implement Python to MS Office. But since that will never happen…
@pshamrock7873 жыл бұрын
I use both. Now that I've learned about the excel wings, I'll use both a lot more.
@Zavyyn3 жыл бұрын
When automating and optimizing for others, I find the user wants to open as few applications as possible, leading to preference for VBA as macro/module solutions in Excel and complex Access databases (Especially if those databases already exist). Often, if I consider doing something in Python instead of using VBA it is because it is a one-time task that will not require training somebody.
@NZBruceman3 жыл бұрын
Thanks. Great summary. My company sells Excel tools that integrate with Oracle EBS, mostly in the US. We have employed VBA now since Excel 97 and there are up to 50,000 lines of code in some of the tools. Never underestimate the reluctance of IT to install stuff on their networks/PCs. Having VBA available without an install has been an incredibly important advantage. We have new C# based software creating an Addin and the install is a new barrier we have to fight to overcome, every single time. VBA will never die. Look what happened to Microsoft when they dropped it in Office 10 for Apple! They were burned.
@Excelmacromastery3 жыл бұрын
Thanks for shasring Bruce.
@rahul7rock3 жыл бұрын
I am using both python and VBA as of now. But will stick to one which you are teaching in near future 🙂
@moekyawthu88613 жыл бұрын
I leraned a lot from u. Thanks a lot. Now I use Excel VBA for details process in Excel. Python for other general things.
@jimclay47753 жыл бұрын
I use Excel and VBA to review geochemical data sets for groundwater monitoring. Recently I have been doing data processing in Excel followed by a handoff to R for data visualization graphics. My data sets aren't big, but they are too large to simply do a visual inspection of the numbers and draw confident conclusions. This video has inspired me to take a look at Python. Thanks!
@excelrobot3 жыл бұрын
Actually, you can do the same thing as results = df.loc[df['Geography'] > 60] in VBA in one line of code if you use Ctrl-T to make your range an Excel table named "marks". VBA would be: results = Application.Filter([marks], Evaluate("marks[Geography] > 60")).
@Excelmacromastery3 жыл бұрын
Nice - I know there are many ways to filter the worksheet data. Filter and Evaluate functions tend to be slow with a lot of data. But what I was demonstrating here was to filter an array rather than the worksheet data. Arrays are very fast to use in VBA but sadly lacking in functionality.
@excelrobot3 жыл бұрын
@@Excelmacromastery Since FILTER is one of the new dynamic array functions, it is blazing fast in Office 365. I just did a test with 200,000 records returning 14,000 records in the filtered set and it was pretty much instant (
@KaiWeissmann3 жыл бұрын
@@excelrobot Hey, I just tried your suggestion and it gives me an error2015. I have a table named "Stammdaten" with a column "Provisionsanteil". My code looks like this: Sub NeuerFilter() Dim results As Variant results = Application.Filter(["Stammdaten"], Evaluate("Stammdaten[Provisionsanteil]>3")) End Sub Is there something I did wrong?
@excelrobot3 жыл бұрын
@@KaiWeissmann Try [Stammdaten] instead of [“Stammdaten”].
@gaitanpol3 жыл бұрын
In fact like many coding langage, there as highly specialized libraries / routines that one need to learn to get things done. I am not sure the syntax is really what makes the difference.
@richardgilbert90423 жыл бұрын
Python has some of the same advantages as R, but there's a lot more to Excel applications than just a little data read/filter/write. I have written apps in VBA that dynamically modified the UI in Excel, changing menu options based on queries that are based on initial user selections. The user then made additional choices from the dynamically populated lists, and those choices were used to build SQL strings, query an external DB, process the query results, and populate reports and charts in the workbook. Complicated? Well, yes, but I wouldn't have wanted to try it with Python. All the necessary code and structure was encapsulated in the saved Excel workbook without 3rd party appendages to be installed/managed. Power Query wasn't available back then, but I'd probably look at integrating that with VBA in the applications I wrote before messing with Python/Excel hybrids.
@Deepanshu3022 жыл бұрын
Can you teach me VBA. With real uses.
@simonghislain3 жыл бұрын
I had 3 moments during which I was like "yeah but then you would need to do this" and then you immediately talk about it. This shows your great mastery on the topic. I completely agree with your conclusions. Thank you for this video !
@thecodfather71093 жыл бұрын
Exactly the video I needed
@Excelmacromastery3 жыл бұрын
Glad you like it.
@TheVidit1433 жыл бұрын
Hello father
@ymlaos98503 жыл бұрын
I have stopped using Excel for 2 years now. Managed to exit gracefully and use python for doing my LET. L=Load (MBs of csv
@H2701273 жыл бұрын
Another excellent video from one of the very best around, thank you so much. So funny because yesterday I finally decided to start learning Python.
@ersingungor6101Ай бұрын
I really like the way you illustrate the things in a logical order
@coffe4wolf3 жыл бұрын
Python will never replace VBA. There are too much cases when you cannot install new software (due to IT policy, security rules, etc.) but excel and VBA exist on almost each PC with Windows
@luckyea73 жыл бұрын
согласен!
@BrianBattles3 жыл бұрын
True
@boschmitch3 жыл бұрын
Python ALONE would not replace VBA perhaps. Its the entire cloud or hybridize cloud would remove the feasibility of running codes on PCs. For medium to large companies, using excel is a decrease in productivity. You get data from server, manipulate it then analyze. Why not do it on the source (server-side)? For small companies, cloud equivalents or even Google Sheet can do without installing anything. Most company can survive without Excel tbh (our do). As a bonus of server-side deployments, you can run these in any OS flavor you want.
@coffe4wolf3 жыл бұрын
@@boschmitch I'm agree at the point of using cloud tools, but there are a lot of cases when excel/vba still useful in big companies. We use VBA to automate a lot of processes in SAP which could take a lot of time to do it manually and too expensive to handle it with ABAP-developing.
@alanhood96753 жыл бұрын
For me it was, " Is it worth learning VBA ,to do something that python can do just as well (or better) ,when I want to learn python anyway". You convinced me, I'm doing it in python!
@drblackra3 жыл бұрын
⁸
@ichbrauchmehrkaffee57853 жыл бұрын
Wise choice
@davecks30423 жыл бұрын
Brief and concise is your explanation in a single short video . Thanks
@duncanmorrison98603 жыл бұрын
Great video Please more videos on Python with Excel.
@sparetheearthlings5 ай бұрын
Excellent video. Thanks for breaking this down. Was curious what the pros and cons of both were and this answered my questions!
@dh82033 жыл бұрын
Python looks great, but VBA comes integrated in Office. Your conclusion does a great job of laying out why many people, including myself, won't be switching to Python any time soon. I create things for other people to use, it can't require them to set up Python and then fail when they move to a new machine, or re-install Office.
@edrobinson82483 жыл бұрын
I had to stop this video half way to break off and tell you how taken aback I am. Enlighteneing and Very well presented. Thanks (VBA author)
@JLPT-AIsensei3 жыл бұрын
My company puts hard restrictions on any software that is excluded from the acceptable software list which is provided by IT Dep, so that if I (maybe anyone other than me) want to use python instead of VBA then I need to take some approval from IT department (very very hard to get it). Even MS Access is not accepted for my department, and MS Office Suite only contains 4 applications: Excel, Word, Powerpoint, Outlook. So in my opinion, Excel VBA is the best stuff for data manipulation in office environment. I totally agree with Paul.
@krisvantuerenhout5373 жыл бұрын
Once Python will be installed on as many machines as Office , it will take over i think. For IT people for sure. For NON-IT people i don't think so (not yet). Recording a macro is so easy for the majority of tasks you want to automate. Far from optimized code , but it gets the job done.
@edudecnop3 жыл бұрын
I didn't know Pandas was able to read and write in Excel files, that's good news for me. I tried to include an add-on for python application in Excel in the past (don't recall which one), but it let the program quite slow, so I gave up trying to use them together. I'll rethink about this possibility in future soon. Thanks for the video!
@Freddyhb13 жыл бұрын
This is the best video I've seen on KZbin on Py vs VBA
@Excelmacromastery3 жыл бұрын
Thanks Fred
@elicesroman75003 жыл бұрын
Thx Great video. The problem with python is that commercial organization refused to install open software because it is not supported. In terms of efforts - rewards I think that python is much more better than VBA Excel. I think with a few hours of coding python will allow you to do much more than VBA Code.
@shehab9763 жыл бұрын
I think they know python as snake rather than a programing language😁
@toddbrannon62623 жыл бұрын
Excellent video! I work with a team that develops tools in Excel and Access. VBA and SQL are king (and queen, I guess?). There has been some discussion about using Python, but it becomes an issue of support. I am the only one on the team with any Python experience and if I were to leave, they would be forced to backfill with someone who has Python experience. The elephant in the room is that Python does not come preinstalled on Windows machines like it does on Mac machines. This is a huge problem and some of the comments here have already mentioned this. Until that happens, if ever, I think you will see adoption of Python as an alternative to VBA be painfully slow - at least within companies that use VBA like mine does.
@Excelmacromastery3 жыл бұрын
Thanks for sharing Todd. You make a very good point.
@Moh23Moh3 жыл бұрын
can you make a vba code that open the browser and go to a page reads a captcha fill it in a text box in the web page and press enter and the code should work at a certain time
@SolidSnake593 жыл бұрын
I would love to see your video where you teach Python!
@Excelmacromastery3 жыл бұрын
I may do more in the future.
@TheMcHonky3 жыл бұрын
@@Excelmacromastery That's really another strength of Python. The amount of quality learning material, especially for getting started with Python - Corey Schaefers channel is my favorite. For Excel - well there is this channel :-) which is awesome, but in general there is not that much out the for improving VBA skills.
@danielcook12713 жыл бұрын
@@TheMcHonky this 100℅!! I'd love to master vba but can't find enough decent materials. I've a number of books but they more show you what you can do with vba rather than teaching it. Whereas Crash course python is just an amazing introduction to python
@johncheung49053 жыл бұрын
@@Excelmacromastery Please do. Your explanation is superb.
@johncheung49053 жыл бұрын
@@danielcook1271 I learn by doing. I suggest you try this way too. Think of a problem, real or imaginary, in Excel. Then begin writing code for solving it. Whenever you are stuck, search the internet for the solution. You will spend a lot of time in the searching and testing out which solution works best, but this experience will prove very useful.
@gregorymathy27823 жыл бұрын
Both are fine for me it depends on what you need to do. Pandas is a great tool that’s being said excel can be seen also as a ready to go graphical interface. whereas in Python you also need to create it … so my dream would be to get a more dedicated Python integration with excel and MS office that would be so great …
@edravtv4367 Жыл бұрын
dream coming true...
@derpythecate68423 жыл бұрын
Not for malware. VBA is still really handy for executing code on unsuspecting victims via macros.
@1612ganesh3 жыл бұрын
Really you are awesome. I watched your all videos and learning VBA.
@sinus22203 жыл бұрын
Fantastic video! I'm currently in the process of automating not only excel spreadsheets but also web and file operations at the same time. Granted, you can do all of this with Excel and relevant reference libraries, but it seems Python would be more robust and flexible. Most probably I'll be using both in conjunction :) I hope VBA will remain popular forever as I like this coding language very much. Thank you for putting all of the essential information in such a concise yet very informative clip!
@Excelmacromastery3 жыл бұрын
VBA will be around for a long time to come.
@Unchained743 жыл бұрын
Great video. Right now python is my favorite language. I'm still a newbie, but its actually pretty amazing to see the things you can do with it. I'm trying to get to where programming in python is just natural.
@Excelmacromastery3 жыл бұрын
Keep going and you'll get there.
@zzzzzzzzzzzzzzzz93 жыл бұрын
Nice video. I'm a heavy user of excel and I'm not very good at VBA, but i learning it. However, this video has got me thinking about switching to Python. The disadvantage is as you stated, installing the application on my work laptop
@cuejorge20033 жыл бұрын
I totally agree with you. VBA is part of Excel and those of us who have used it for many years, as you said, we already have written codes that will not work if VBA is eliminated
@milesdedrick46323 жыл бұрын
Well that's actually part of development. As languages depreciate in value and newer ones start to replace them it warrants a rewrite/recode
@BrianGallagher3 жыл бұрын
I started using python because the tables of data I was working on were 2.5 - 3 million rows. That's a massive benefit python has over excel. I found the learning curve to be far easier than VBA - python is much more intuitive. For installation purposes, the Anaconda environment is an easy starting point for new python users. Numpy handles calculations on large arrays effortlessly, so enriching data is simple. I still use excel, but I now always do the heavy lifting with python.
@evgeniy192 жыл бұрын
You can use Power Query and Power Pivot to work with millions of rows effortless. They're a bit harder to master, but already built in Excel, which has several benefits.
@ChillGuy511 Жыл бұрын
Not even 2 minutes in and already subbed!
@WildLoverNBN3 жыл бұрын
Please start teaching us to Python... Thanks P.Kelly
@barttitulaerexcelbart94003 жыл бұрын
Thanks a lot, really interesting. I would love to see a video where you compare power query with python. I would also like to see some real live cases where Excel reaches its limits and Python can take over..
@Excelmacromastery3 жыл бұрын
Great suggestion!
@justinlee97893 жыл бұрын
Time series analysis. For instance how do you make a rolling covariance matrix? Doing it with excel will cause a dimensionality nightmare
@macedoniojr3 жыл бұрын
Simple example (not real python fan yet): Python can read 2GB csv file with millions of rows. Excel will load 1mln 48k rows and cut off the rest or throw error....
@barttitulaerexcelbart94003 жыл бұрын
@@macedoniojr with power query in Excel this is not an issue
@alexaneals81943 жыл бұрын
@@macedoniojr In reality if you are doing that type of work in Excel then you are wasting your time. A relational database can handle that data a lot quicker and with more efficient results. You can use Excel as a frontend and have the database do the grunt work.
@ChristianBeringer3 жыл бұрын
One thing was missed out: Big Data and Machine Learning and connection to database-servers. VBA is quite useless for ML or big data analysis in databases, while Python offers many libraries for machine-learning, computer-vision, simulations and even 3D-data visualisation.
@sandragrushoff98443 жыл бұрын
yes - but ML is big data not real learning. Show an amoeba enough pictures of a cat and it can do the task. ML is interesting but it's not learning or intelligence or with the whole world networked the singularity would have blown us away by now.
@peterlilley68193 жыл бұрын
Great video Paul, I had been evaluating this myself, I had heard, but not qualified that Python was significantly slower than vba at runtime.
@Excelmacromastery3 жыл бұрын
I haven't done any benchmark testing yet so I can't say for sure. For the Filter task in the video it does run slow compared to VBA.
@g07denslicer3 жыл бұрын
4:26 wait a minute, you just have to supply the sheet to it? You don’t have to specify a region? What if there’s an unrelated table off on the right of this one? When you tell python to print the 3rd line, will it print the results of the grades table, a bunch of blank spaces, and print the same line of the other table?
@Dabayare3 жыл бұрын
Shocked to see if VBA is still around. Must b nice working for bigger companies. Never seen it in the small niche companies I been working with over the years
@tumtum69103 жыл бұрын
Yes there are corporations which use VBA and they don't know python...😔
@mzucs3 жыл бұрын
In a spreadsheet scenario Python can be simpler to learn algorithm and deal with Big Datas, but VBA it is not as bad as people say, It is just need a good update. By the way, in an office environment if you aim for automations and optimizations, mainly for daily tasks and for other people to use, then go VBA. It is way easier to create a simple, useful and visual application and send to other people.
@Excelmacromastery3 жыл бұрын
That's for sharing your experience Matteus.
@ichbrauchmehrkaffee57852 жыл бұрын
VBA isn't easier, it's just allready integrated, whereas in python, you currently have to connect to Excel from the outside (and you don't get autocompletion because of that)
@andy.13313 жыл бұрын
To use VBA with Excel all you need is just Excel: no additional IDE (+1), no additional components (+1) - totally +2. Using Python for Excel: additional IDE & components - totally -2. This is very important in case you deploy your project to any customer (inside your company or outside it) - no additional prerequisites and maintenance fees. I don't see any reason to replace one scripting language with 2 plusses with another one with 2 minuses. Actually, higher performance of Python with Excel could give it a huge plus. But author don't take it in a count, because, highly likely, there is no such a difference in their execution performance. So, Python or VBA - is just a matter of a personal preferences (except if your boss is a fan of Python :-)).
@changnoiboi3 жыл бұрын
Excellent, thank you Sir. Just getting into VBA & Python and this has helped guide me to my next learnings
@goombakiwi3 жыл бұрын
I've written VBA for some time. My experience shows that some companies are already apprehensive about allowing employees to use the available VBA. I had one employer disable access to macros, until they realized our ADI's were dependent on them. Staff are generally not hired for programming skills and the push to construct workbooks for basic excel users will continue to be prevalent. With increased cloud usage and SharePoint; MS appears to be focusing on Typescript(Javascript). The prospect of bringing on an enterprise application for Python; is not promising. The recent ransomware news might further diminish employee access to automation features.
@Excelmacromastery3 жыл бұрын
Thanks for sharing. You make some interesting points. TypeScript has still a long way to go to compete with VBA and it's not clear if that is Microsoft's aim.
@24Boli3 жыл бұрын
As usual, fantastic video! I guess that Python won't be able to "kill" VBA in a short term, but eventually is likely to do so
@excelrobot3 жыл бұрын
Before VBA was XL4 macros, and they are still supported after being replaced by VBA almost 30 years ago. Even if Python or TypeScript replaces VBA, it will live on for another 30 years from now.
@Yalali1 Жыл бұрын
With the recent announcement of Python in Excel, is it safe to assume that VBA is now redundant if someone can use python instead?. an update to the video with the new python feature would be appreciated.
@Excelmacromastery3 жыл бұрын
You can download the code(both Python and VBA) from the description below the video. *Quick note* on the VBA Array code in the video that many have commented on. I am aware that I can read the row directly from the range. What I was showing is this: Accessing ranges directly in VBA is extremely slow and gets exponentially slower if you are dealing with large data. That's why I use arrays. You can write from a range to an array in one line of code. It is fast and efficient. Reading through arrays is also very fast and unlike ranges the performance remains consistent as the size grows(see kzbin.info/www/bejne/gKukfaaahtudqJo) The problem is that once your data is in the array there is no sort, filter, slice etc. functionality. You have to write your own code to do this. (That's why I created an Array Class - see kzbin.info/www/bejne/kIrbkmCHYtOGjpI). In Python and Typescript(and most modern languages) it is trivial to do this. I see this as a big problem in VBA if you are dealing with large datasets. A new user writes code and it is running extremely slow. They either conclude VBA is slow and give up or they discover that using arrays will make the code much faster. Once they switch to an array they have now lost the range functionality that allows filtering, slicing rows/columns, sorting etc. They then have to write the code to do this or find it somewhere.
@Nic_Holas2 жыл бұрын
there is no sorting and filtering in python either, it's in pandas library. what stops me from writing pandas for VBA and then claiming it's advantage of VBA. not trying to argue against or for either of the languages, just pointing out that often claimed advantage of python is libraries and those are really not part of the language. a real thing to consider in world of office apps (spreadsheets, small db) is ease of use and overall performance, and VBA wins, and even survives it's owner's intention to kill it.
@anishpillai3 жыл бұрын
My workplace uses excel extensively. And we had developed so many VBA applications over 5-6 years. Once we switched to python, an entire new world was unlocked. We have used async, pandas, django, openpyxl, sqlalchemy, pysimplegui and so many other libraries in python which makes our developers life so much easier. Yes VBA definitely has its benefits and there are some shortcomings in python, but the benefits of python massively outweigh the shortcomings, atleast for my workplace. Also most of the comments mention about installing python for end-user, but we have never done that. We use pyinstaller to generate executable codes that needs no installation for end-user. And it runs on any pc just as it does on my computer, without having to install anything for others.
@Excelmacromastery3 жыл бұрын
Thanks for sharing Anish. Great to hear your experience of using Python.
@anishpillai3 жыл бұрын
@@Excelmacromastery thank you for the great video
@FizzyMcPhysics3 жыл бұрын
This is exactly what Ive been wondering for a while! Thank you!
@FizzyMcPhysics3 жыл бұрын
This was really useful, thanks! I'm one of those people who makes macros in a large organisation. While I'm sure everyone could install Python on their laptops, it's just not practical to get them to do it and maintain it. Also, my code resources and knowledge are so mature now, I'm just too invested to make a change worthwhile. I'd also have to use a mix of Python and VBA to do things like formatting and emails.
@Excelmacromastery3 жыл бұрын
Thanks for sharing Benjamin.
@FizzyMcPhysics3 жыл бұрын
@@Excelmacromastery After talking to a colleague, I think it should be seriously asked if Alteryx will kill VBA in the near future. I'm seriously afraid of Low/No Code solutions taking the spotlight soon.
@rrrprogram86673 жыл бұрын
Absolutely great video.... You are the master in your area ....there is no 2nd to you
@wayneedmondson10653 жыл бұрын
Hi Paul. Thanks for the view of Python with EXCEL. I've tinkered with it in a small way, but VBA (and Power Query) can currently handle the things I need to automate. Probably, that is true for many people. But, you never can discount an alternate way of getting work done. So, worth keeping an eye on the options (Python, Office Script, etc.). As always, thanks for your interesting perspectives and insights. Thumbs up!!
@Excelmacromastery3 жыл бұрын
You're welcome Wayne. Definitely a lot of options nowadays.
@sandragrushoff98443 жыл бұрын
Intresting vid - I'm a VBA programmer, among other languages, so i've got most of this pretty quickly. I think the main take away point is Python integration, which I think may get rid of VBA (eventually). Otherwise it's just a library. Not only that I can shell out to exe files i've created in another language, or write to an ini set of instructions then do the same. Ultimately Python (in context of VBA) is little more than another library, and there's a lot of libraries, including access to the windows API where I think a lot of power lieth. I'm interested enough to take this seriously though especially as I think everyone will need Python eventually. Moreover - if VBA is rich Italian, Python and others are barked military instructions in a very accurate manner, a far more limited lingo for arguably greater function. VBA programmers may lament the fact they've learned zillions of commands! I'd also be interested to know about the advanced "big data" applications. VBA can do everything in this video and greater. So i'm guessing that if you import 2 million cells and start zooming over them in Python, then VBA may be a frozen spreadsheet and the other may be a quick but two step process then a populated spreadsheet. Cheers for the vid.
@Ashish-23193 жыл бұрын
Great explanation sir. Indeed you have cleared many doubts.❣❣
@robertwoodman7382 жыл бұрын
You make excellent and convincing points for why Python is important and could (perhaps, should?) be part of any extensive Excel development. However, my employer doesn't want me to install or use anything outside of the Office environment. They have several reasons, none of which are essential to this discussion. The bottom line is that any development work I do for my employer must be done with whatever installs with Microsoft Office and works inside the Office environment. That means I must use VBA and not Python.
@Excelmacromastery2 жыл бұрын
It's unfortunately one of the drawbacks of python.
@sethnielsen33253 жыл бұрын
”Python is so powerful and can does all this with just one row” Well yeah that’s how functions work. Sorta cheating if you call a function “one row”
@reng77772 жыл бұрын
1 year later.. i AM watching again this video and now makes more sense why Py will be the #1!!
@SimpleExcelVBA3 жыл бұрын
I thought than after VBA I will go into the TypeScript direction, but now I should also consider Python.
@sankarmis3 жыл бұрын
Nothing can kill VBA...
@RajuMouryaa3 жыл бұрын
Microsoft is working on replacing it with typescript know as Office Scripts
@feather88143 жыл бұрын
@@RajuMouryaa wow that would be so great but what about speed. TS is not known as a good lang for data processing
@souzamotasacul2 жыл бұрын
@@RajuMouryaa sad 😞 I love VBA
@len5499 Жыл бұрын
@@RajuMouryaayeah and it’s 2023 and VBA is still kicking. 😂
@Daekar310 ай бұрын
I'll agree with the other commenters, the biggest advantage of VBA is distribution. Users have Excel and are familiar with it. No additional installs are required. They access one file and it just works. I would consider Python or something else if there weren't distribution challenges associated with them, but embedding VBA in our controlled documents is a no brainer.
@wsross31783 жыл бұрын
I used to work with vba due to installation restriction. Later on i get to work for excel reporting from unix server with built-in python. I get green light from the IT security to install pandas offline and it really replace a lot of manual spreadsheet process.
@Mandelbrot5673 жыл бұрын
Excellent information, how about a comparison of python vs typescript for excel?
@Excelmacromastery3 жыл бұрын
It's a good idea. I'll keep it in mind.
@FernandoRamosOstroswky3 жыл бұрын
hello from Brazil !!!! Thank you for amazing videos that you posted. It's a hard decision for MS to integrate the phyton to VBA, because they created the typesript, but... It's a question of time, I think...
@cyphi13 жыл бұрын
no disrespect for Python lovers, but I hope they leave MS Office and VBA alone. VBA is accessible and offers a way to implement easy solutions for users no w/no elevated permissions needed.
@logic36863 жыл бұрын
Nice point, I hadn't thought of that.
@norpriest5213 жыл бұрын
@@logic3686 Unfortunately, VBA language is not so intuitive to me when it comes to writing it. Really bad designed language
@NeoTechni3 жыл бұрын
@@norpriest521 I can't agree with that at all. It's much more intuitive than C, LUA or Python. To the point where I don't understand why we even use C style syntax anymore.
@steves92503 жыл бұрын
I think VBA will be available for a while but they are moving to JavaScript/Typescript in Office365
@stefanopantaleoni92323 жыл бұрын
@@norpriest521 Fully agree. As you can see from the example in this video: import pandas as pd df = pd.read_excel(myXlsFile, sheet=mySheet) dfx = df[df['Result']>60] pd.write_excel(newXlsFile, sheet=mySheet) Can you do it with VBA? Yes, but... how long does it take? How easy to read and maintain is your code? And that was a trivial example, imagine a real world situation (I deal with this kind of stuff on daily basis). The more complicated your task, the more disadvantageous it becomes to rely to what whas released by Microsoft in the 90's and remained unchanged since then. VBA will have been a top-notch technologies at the end of the last century, but now it is falling behind. Microsoft should really deal with it. Either they come up with something new (and I know they are developing something similar to PowerQUery language to make it work with Excel), or they'd rather adopt something new, and Python could be a very good candidate.
@manndipp2 жыл бұрын
This was immensely helpful in clarifying how to use python in excel
@iljunjang3 жыл бұрын
Thank you for the great video, always great content. 2 questions: 1) isn’t VBA much faster to run than Python for Excel programs? 2) Also, doesn’t VBA give us much wider library of Excel objects (such as conditional formatting), at least so far? I build enterprise VBA apps and I’ve felt that coding in Python (and JavaScript also) is inferior for speed and control, though I could be wrong. Wud appreciate your opinion.
@ichbrauchmehrkaffee57852 жыл бұрын
Those Excel Objects you're talking about have nothing to do with VBA but with the Excel API-Object. The thing is, VBA is fully integrated in Excel with its own editor that can access the API-Object and thus the Excel-library, whereas in python, you need to connect to it from the Outside. But that would (hopefully) change, if MS were to implement Python in their Office products. But I think even more important would be an Update to the VBE-Editor...that thing is just a PAIN in the nuts to work with..
@tumtum69103 жыл бұрын
I personally feel that it is easier to use python with excel files. Many people don't realise it...
@yeoyinghui3 жыл бұрын
Very good comparison. Will love to learn from you too!
@Excelmacromastery3 жыл бұрын
Thanks for watching!
@TheRealMake-Make3 жыл бұрын
Rather than Microsoft purchasing Python, why don’t they simply incorporate the best of Python into VBA? The steep learning curve, time-consuming organizational software installation, user privileges, IT regulations...Python is simply too expensive as an organizational tool (for now). The code is beautiful, though-this was my first glimpse of it!
@dollarbill89593 жыл бұрын
The only problem is bureaucracy and people like you.
@TheRealMake-Make3 жыл бұрын
@@dollarbill8959 😂
@ziggle3143 жыл бұрын
Very timely. I have been thinking about running Python instead of VBA. Thanks!
@Excelmacromastery3 жыл бұрын
You're welcome.
@michaels1813 Жыл бұрын
For the work I am doing VBA is simple and gets the job done. Having to install Python would result in having to setup another tool. For now I will stick with VBA.
@ahrorkuldashev96033 жыл бұрын
Really appreciate your time and effort to create this great educational video.
@arav84312 жыл бұрын
Great explanation, please upload python with excel manipulation more videos 👍👍
@GanovAlex3 жыл бұрын
In real not only Python can be used to work with office, commonly any language can be used for this purpose. Everyone makes their own choice. But it definitely that Python has very short notation to do the same things. Thanks for video 👍
@elboon_803 жыл бұрын
I agree with your conclusions. Excel and VBA will stay for a long time, and it is really true for simple prototyping of ideas, it is ideal. The bane of excel is that the "programming" in cells... it works, but it is UNREADABLE. We have an organically grown Excel sheet that contains so much of the company's know how in it... and only 1 person who really knows the ins and outs and the whole company sort of have to depend on this file... Everyone hates the file, but can't live without it... that's the love-hate relationship of Excel I think
@umeshlangade92313 жыл бұрын
You are always upto the recent trend.. thanks for sharing valuable knowledge 😊
@Excelmacromastery3 жыл бұрын
You're welcome.
@Jamesedwardkoch3 жыл бұрын
Very good and important video. I am very well versed now in VBA (with a lot of special thanks to Excel Macro Mastery), but I have started learning Python quite eagerly. What was said about the setup required for Python is 100% true. I now have to keep a list of all the Python libraries I have installed so that if and when i want to run my Python scripts elsewhere, i first have to spend some time carefully making sure the other PC has got all it needs. The main benefit i have had with VBA is that people receive it so easily, they are all already familiar with an Excel file and they open it without hesitation. I believe i will use both languages extensively into the future, side by side, IF and until MS decides to incorprate Python. But i think they're going for Office Scripts.
@Jamesedwardkoch3 жыл бұрын
Just another note, I am busy writing a nice little VBA app for my fellow varisity students. I can just email it to them. This project would not have been as easiliy doable with Python because of the setup. The irony is that the VBA project is to help them learn Python, lol.
@Excelmacromastery3 жыл бұрын
:)
@kjinnah3 жыл бұрын
Great Video, thank you. Python's universality is definitely growing into many areas, including IOT hardware, etc. Data manipulation is certainly part of using excel. However, In developing Excel apps I find VBA code has developed closely with the nature of excel, like formatting, cells, ranges, tables and indeed whole sheets, for example creating & printing invoices, orders, etc, or printing well formatted reports etc. Also the use of VBA forms to input data, and show results. In addition VBA is closely tied to excel functionality, for example VBA code to run upon 'double click' on a cell, or range by VBA code in a module or on within a sheet etc. Also VBA code can be written by 'recording' actions and the just modifying the code to clean it, or just as a way to learn VBA on the fly as it were, especially if using excel built in capabilities such as pivot tables, data visualization tools or indeed Power BI. I just mention some issues for considerations in a wider question of Python Vs. VBA for new users who may be weighing a way forward.
@Excelmacromastery3 жыл бұрын
Thanks for sharing. Some interesting points.
@jcaskey063 жыл бұрын
I agree. It is just so darn easy to create a quick macro, then spend a little bit of time to clean it up to remove the excess junk. It creates a template as a starting place. Very useful for somebody that doesn’t do it all the time and doesn’t have the commands memorized.
@kelvinteoh90582 жыл бұрын
I felt that the example used in this video could have easily been performed using formulae rather than vba which is what I do these days because vba requires troublesome signatures from our ICT security department on my company laptop. The main reason I have used vba was if I needed to execute event based calculations or actions which formulae can't. In fact, because vba is quite inefficient in some aspect of interchanging data, I tend to use a worksheet as a form of registry to keep the last known dataset rather than keep it as a variable in code. My question to this longwinded comment is whether the Python add in is capable of these. Thanks.
@zm28133 жыл бұрын
Thank you for this video. It's a "food for thought" now......VBA is classic. Python is not that specifically explained and applied. It looks like an old MS DOS screen to be honest. The question from me is how much data manipulation Python requires. Excel has capability of combining VBA with SQL and Power Query, as well as creating models in Power Pivot for Power BI.....
@Excelmacromastery3 жыл бұрын
It does look like DOS actually:-) Most programming is done nowasays with this type of setup and a blackground.
@davidlazarus41982 жыл бұрын
Like the video. The fact that Microsoft have brought Guido von Rossum out of retirement (inventor of python) should give some indication of where Microsoft intends to go in the future.
@kevincen57273 жыл бұрын
Over last cup of years, with Python i have written applications to manipulate data in excel and automatically do things on website, google maps, office 365 and so on. I also used VBA few times when i just need some quick and dirty stuff to be done in excel alone when formulas are not enough. I guess the biggest problem with VBA is that all you can do stays in the realm of Excel, or Microsoft suite at most, while with python there's much more potential. I don't use the "record macros" that often as i can get solutions easily from VBA documentation or just stackoverflow. But i guess if you are beginner to coding then start with VBA is a good idea. Meantime always keep an eye on Python if you want to link your spreadsheet with other part of your process.
@pop2mcar3 жыл бұрын
I use python when I have to search through 100s (sometimes 1,000s) of files, make column changes, etc. It works great!
@Excelmacromastery3 жыл бұрын
Good to hear Robert.
@agnvstosantras85993 жыл бұрын
It is easy to build some classes in VBA to do what you show with Python. You didn't show that Python is better than VBA but you said that someone can find Libaries (to import) in Python for better work.
@Sancarn3 жыл бұрын
And similar libraries exist for VBA. Realistically, they are pretty equal. The only benefits shown are use of VSCode, which you can also use to code VBA :)
@MrMallesh13 жыл бұрын
nice video , lot of doubts initially how to use python in vba. Doubts got cleared. add new videos on python I love your videos nicely explained. thanks
@PerSjoborg3 жыл бұрын
This works in VBA for me. Dim Count_Rows As Integer Do Count_Rows = Count_Rows + 1 If ActiveSheet.Cells(Count_Rows, 1).Value "" Then Debug.Print ActiveSheet.Cells(Count_Rows, 1).Value Else Exit Do End If Loop
@DanielADamico3 жыл бұрын
My opinion: I think that a more realistic scenario is desktop applications like excel being gradually replaced by their online versions. Excel Online is getting better and better and I think that Office Scripts (that runs only on Excel online) will eventually replace VBA because there will be no need to have the Excel Desktop installed anymore.... but this would take some time of course...maybe 5-10 years ....
@omerdurak8843 жыл бұрын
Your explanations are very useful and comprehensible as in your other videos.
@Excelmacromastery3 жыл бұрын
Glad you like them!
@danielcook12713 жыл бұрын
I love VBA use it daily for my job and at home. Self taught but I'm still at a beginner \intermediate level and I've reached the point where I can use vba to do all I need I just don't think my code is particularly efficient. I find remembering the syntax tricky and still Google the simplest things. I'm struggling to find resources to help me make my vba code better. Just in the last few weeks I picked up a couple of books on python and started learning it. I've already learnt so much and find it easier \ more intuitive than VBA. Also the IDEs are very helpful as you mentioned in your video. I think I'll probably continue to use both languages. There's just something kinda fun about VBA. Everyone's learning python and I think it'll be useful to keep up vba if only to mAintain macros used at work... Brilliant video btw, it's a question I've been thinking about a lot recently but isn't office scripts going to be the thing that replaces VBA??
@Excelmacromastery3 жыл бұрын
Thanks for the feedback Daniel. Coding in Python is definitely more convenient once you get up and running. Office Scripts isn't confirmed as a replacement for VBA.
@tjchance51113 жыл бұрын
Very interesting, I was wondering if I should use Python or VBA, now I have a better idea. Thank you Paul!