How to Use Arrays Instead of Ranges in Excel VBA

  Рет қаралды 208,800

Excel Macro Mastery

Excel Macro Mastery

Күн бұрын

Пікірлер: 267
@Excelmacromastery
@Excelmacromastery 7 ай бұрын
Learn how to write real-world Excel VBA code: 👉courses.excelmacromastery.com/
@BenjaminHouot
@BenjaminHouot 5 жыл бұрын
Best vba channel i ever found !
@emmanuelgonzalezescobar2114
@emmanuelgonzalezescobar2114 5 жыл бұрын
X2
@1802bask
@1802bask 3 жыл бұрын
Dear Kelly Thank you and I want to learn more about Excel VBA
@TimePasser
@TimePasser 3 жыл бұрын
This is exactly what I am looking for. I work in telecom industry. It took me hours to process raw data.. now .. down to less than 20 mins with a humble system. Thank you .. where have you been 10 years ago ? I can't thank you enough .
@chandrachurdatta5844
@chandrachurdatta5844 3 жыл бұрын
20 Minutes to 33 seconds!!! Thank you very much.
@redfeather22sa
@redfeather22sa 2 жыл бұрын
Best Video on the Interweb , Internet & Galaxy !! Star Paul !! Your an Amazing Star !!
@fmichaelhemmer3762
@fmichaelhemmer3762 2 жыл бұрын
Absolutely fabulous instruction. Seeing the array filled with one line of code and then watching it crunch 2500 records in a blink, was the most fun I've had in a while... sad, but still fun! Thank you Paul.
@Excelmacromastery
@Excelmacromastery 2 жыл бұрын
Glad you liked it Michael.
@Neckbeef82
@Neckbeef82 2 жыл бұрын
Has to be the best vba tutorial I've seen on KZbin. Lots of garbage stuff out there. I'm a self taught VBA user, picked up a few very helpful codes and ideas watching this. Thank you
@Excelmacromastery
@Excelmacromastery 2 жыл бұрын
Glad you liked it.
@gonzaortin739
@gonzaortin739 Жыл бұрын
The information you give us is so clean, easy-to-understand and implement… I just love your channel, Im hoping to buy the handbook soon
@Excelmacromastery
@Excelmacromastery Жыл бұрын
Thanks Gonza
@jxggxr_dxv
@jxggxr_dxv 5 жыл бұрын
I like the format of your videos and the way you explain things. Even if I know some of them, I still watch just because you're one of the very few on youtube that is actually enjoyable to listen to.
@Excelmacromastery
@Excelmacromastery 5 жыл бұрын
Thanks
@grzesiekhallomoto5920
@grzesiekhallomoto5920 5 жыл бұрын
Magnificent.... I have very complex range operations which take my program 281 seconds to perform. With this method I reduced the time to under 5%.... Best ever YT content I've encountered. Keep doing, don't stop. Ever! It has the potential to be great...
@stevennye5075
@stevennye5075 5 жыл бұрын
I am self-taught and I didn't fully grasp this content the first couple of times I looked at it. I decided I needed to better understand it and it now makes sense.
@canterburyworkshop5631
@canterburyworkshop5631 15 күн бұрын
Fantastic! This is just what I need to reconcile a physical hand count of inventory (Inventory Sheet 3), take the variances and write them into Stock In-Stock Out (Inventory Sheet 2), and using a simple SUMIF formula (on Inventory Sheet 1), the array format quickly reconciles my Quantity in Stock (Inventory Sheet 1). Only issue is that I have UPC codes set up as text and VBA Code is printing it out in scientific notation. Will see if formatting column to Text keeps it from doing this. Still, I truly appreciate you VBA videos. Thanks!
@mike_case
@mike_case 5 жыл бұрын
Thank you Paul for all your content!!! Dictionaries, arrays, collections and classes are the best.
@manassehkisame6286
@manassehkisame6286 2 жыл бұрын
This video got me up a high wall...by making my code cut thru a dead end(error) and in a fast way...Genius!
@coryc9040
@coryc9040 5 жыл бұрын
From someone putzing around with VBA for a few years, finding R Studio was a godsend. Perhaps there are special instances where you might have to use Excel, but I'd advise anyone who thinks they should spend time learning to code VBA to give R a try.
@natejewkes
@natejewkes 4 жыл бұрын
Where have you been all my life? This is awesome!
@smanzoli
@smanzoli 3 жыл бұрын
Thaks!!! Have just changed the code in one of my macros to use arrays. I go through 200k lines in a table. Before, it took 3m20s, now it finishes in 12s, 16x faster!
@Excelmacromastery
@Excelmacromastery 3 жыл бұрын
That's great to hear.
@luisdmoreyra
@luisdmoreyra 3 жыл бұрын
Amazing!! I watched tons of vba videos (I'm newbie) and by far this video gives a incredible edge because of its clear and concise information. Excellent!! Great work, please keep it up!!
@querrythis
@querrythis 2 жыл бұрын
Incredible how efficient you codes are, yet explain it so simple. Genius!
@SuiGenerisGuy
@SuiGenerisGuy 4 жыл бұрын
I stumbled upon something quite interesting when playing around with this. If you try to set an array, it will return the properties of each cell in a range instead of the value of the cells in the range. Very useful to get a number of properties information
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
If you use Set with a variant to a range it will return the range rather than the array.
@redangrybird7564
@redangrybird7564 Жыл бұрын
Mr Kelly, you are a champion 🏆 😎👍
@krn14242
@krn14242 5 жыл бұрын
Great job Paul. Love using arrays now. So much more efficient.
@MGE0007
@MGE0007 4 жыл бұрын
Good stuff.... taking baby steps with my VBA project but every step is in the right direction with these videos!!... (oh and of course I have liked this video!)..
@terryy6938
@terryy6938 4 жыл бұрын
Absolutely a clear and concise explanation of using arrays. Well done! You gained another subscriber.
@jastonkong1409
@jastonkong1409 4 жыл бұрын
Clear and concise, I love it!!!
@b3lg4r4th8
@b3lg4r4th8 5 жыл бұрын
Excellent video.I can see the value of arrays, as opposed to ranges, and am in the process of changing one of my user forms.However, what the video does not cover and I am interested in is the following:Placing the data from the user form back into the table/spreadsheet.
@domenicoieracitano2138
@domenicoieracitano2138 2 жыл бұрын
Why does this have only 69k views? It should be on the top of the recommendations on KZbin!
@Mandelbrot567
@Mandelbrot567 5 жыл бұрын
I have done some of this before, but not the resize aspect. Great tips, thanks Paul.
@davidlinton4127
@davidlinton4127 3 жыл бұрын
Great stuff Paul, big fan From Florida USA....
@m-squaredcontractors9720
@m-squaredcontractors9720 5 жыл бұрын
Wow...i now really appreciate arrays. Very efficient compared to ranges. Thanks Paul
@mahdizahzah51
@mahdizahzah51 5 жыл бұрын
Mille merci Mr Malgré que je suis très faible en anglais mais j'essaye le maximum de vous suivre car je sais bien que votre vidéo est très utile
@BabyBugBug
@BabyBugBug 5 жыл бұрын
mahdi zahzah je vous applaudis d’avoir pris le temps pour comprendre ce qui n’est évidement pas facile à apprendre surtout en une autre langue. Continuez de faire de votre mieux et je vous assure que vous réussirez!
@orlandoeulate1723
@orlandoeulate1723 2 жыл бұрын
Thank you for what you have taught, see if it is possible with an array to load a listbox with more faith than 10 columns faster??? greetings
@peajayjay3622
@peajayjay3622 2 жыл бұрын
Absolutely loved this tutorial! Thank you sir!
@kethanchordia
@kethanchordia 2 жыл бұрын
06:49 - Was Wow--- In one line we can paste the range that we work on
@choijaeho653
@choijaeho653 2 жыл бұрын
Thank you so much for the very useful tips using arrays in vba!! :)
@andrewbeeby2887
@andrewbeeby2887 4 жыл бұрын
Great VBA teacher, I've tried various different tutorials and keep coming back here!
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
Thanks for your support my videos Andrew
@satishk2410
@satishk2410 4 жыл бұрын
Really awsem, never seen such effective and shorter code in my life, again thanks for creating this video, love you, really helped me a lot
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
You're welcome!
@ersingungor6101
@ersingungor6101 12 күн бұрын
Great Tutorial
@TheJoeFletch
@TheJoeFletch Жыл бұрын
This is really really great and has reduce the processing speed of my code dramatically. The only issue that I have encountered is writing the data back to the same location (I am pulling the data from an Excel table) that is filtered. I see very strange results where the first row of the array is inserted into the last line that is displayed. Any suggestions on how to paste back to a range / table that is filtered? I could remove the filter and then re-apply it, but if that data that is changed in the array, then the same filter would not be applied.
@davidevecchio2474
@davidevecchio2474 3 жыл бұрын
Thanks a lot! A very clear explanation that addressed exactly what I was looking for. You're a great teacher!
@cortinas54
@cortinas54 5 жыл бұрын
as always all your videos are amaizing and greats!
@entropyincrease1
@entropyincrease1 3 жыл бұрын
You're a beast. Your content is the best.
@Ts18762
@Ts18762 Жыл бұрын
Mindblowing 💯💯
@EduardoRibeiroEdu
@EduardoRibeiroEdu 5 жыл бұрын
Thanks Man! you and Leila are the best in excel tips!
@haiderbokhari1
@haiderbokhari1 5 жыл бұрын
Amazing tutoring as always! Keep these videos coming!! They're making a world of a difference to my (currently limited) VBA skills. I had a thought, would you consider doing a video on how to use VBA generically? Like copy+paste files across different folders, or using VBA to send a standard email message? Not pushing for this but thought it could be interesting. Thanks!!
@shaikhaziz9703
@shaikhaziz9703 4 жыл бұрын
this is on fire guys...the arrays functions can makes us our projects much easier and fastest....i am also trying to learning this arrays functions codings,....can someone pls explain me why the sir has used i,1 and i,5 in 6:43 minutes i want to use count of columns so what would be just basic formula for counting columns in arrays.
@itsdaj
@itsdaj 2 жыл бұрын
First of all. Thank you for taking VBA to a whole new level! These videos are great. I got stuck at the code at 3:14 . VBA says gives a compile error: "Variable Not Found" for "shData". Any idea why it is working for you but not mine? VBA version is 7.1.
@itsdaj
@itsdaj 2 жыл бұрын
I figured it you. Looks like you are referencing the sheet name under Microsoft excel objects.
@Deepti1512
@Deepti1512 Жыл бұрын
Very nice explanation..... keep it up ....
@donbogdala5428
@donbogdala5428 8 ай бұрын
Awesome work!
@sonderfall1979
@sonderfall1979 4 жыл бұрын
BEST VBA ADVICE EVER!!!! Wow, you are awesome :-)
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
Glad you think so!
@fritzbaden8085
@fritzbaden8085 4 жыл бұрын
This guy is a frickin' genius.
@rrrprogram8667
@rrrprogram8667 5 жыл бұрын
Awesome paul.... U r the master of vba... Great to have u as a teacher
@Excelmacromastery
@Excelmacromastery 5 жыл бұрын
Glad you like it.
@veebee3969
@veebee3969 2 жыл бұрын
Thank you. Great video.
@israelgonzalez677
@israelgonzalez677 3 жыл бұрын
Awesome! Can we access to the cell properties and methods within the array?
@cherifnadjib3373
@cherifnadjib3373 5 жыл бұрын
From Algeria, thank you Paul for this vidéo.
@priyankagupta951
@priyankagupta951 4 жыл бұрын
A million thank you, could you please suggest if we substarct same value what you have mention but I want to add column in the end and calculation value mention . Can we do that?
@josejn2007
@josejn2007 3 ай бұрын
It'd be a proper idea, to explain when this method of using Arrays Instead of Ranges, leaves to be convenient due to the fact that it is too resources demanding.
@johnhackwood1568
@johnhackwood1568 5 жыл бұрын
Another really 1st class video, really simple and robust code that covers so many practical situations
@MrAshfaqahmed
@MrAshfaqahmed 4 жыл бұрын
Great work Sir, you real world examples are so fascinating. I have a question to in the same situation.
@scotolivera8207
@scotolivera8207 5 жыл бұрын
Amazing teacher, each video I watch I learn a new trick. Thanks a lot
@Excelmacromastery
@Excelmacromastery 5 жыл бұрын
Thanks for your comment George
@ProgressiveEconomicsSupporter
@ProgressiveEconomicsSupporter Жыл бұрын
Hey Paul, amazing Tutorials of yours!! Will this code also adapt to added rows within oder at the end of the original table, as it does with added rows?🙏😎🇩🇪
@kman3d
@kman3d 3 жыл бұрын
Thank you Paul! I was wondering if it is possible to get other cell attributes (like cell background color) and not only cell value into an array ( without iterating through the entire range)? I have a very large range which I need to get the background colors of each cell, and it takea very long to run...
@churchun
@churchun 3 жыл бұрын
A query, in an array (not in excel cells) is it possible to include background color? or put background color to certain elements of that array?
@petermaina7111
@petermaina7111 4 жыл бұрын
you are a G.O.A.T. probably also take us through append
@adammorait7429
@adammorait7429 4 жыл бұрын
Many thanks, excellent and well explained, it is crystal clear, your video helped me a lot.
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
Glad you liked it Adam.
@vitheyplastic
@vitheyplastic 6 ай бұрын
Hello Sir, can you help me? I really need your help in coding (including more Listbox to 1Listbox) .Listbox1 (10row and 15column) and Listbox2 (10row and 15column) and Listbox3 (10row and 15column) addTo Listbox4 (30row and 15column). Thank you for all the guidance
@vairamanigopalan1268
@vairamanigopalan1268 3 жыл бұрын
Paul this is awesome. Can this be used in Class Module. if not please show us how to do it. Thanks in advance.
@BeingUnknown
@BeingUnknown 4 жыл бұрын
Really awesome! Never seen such effective and shorter code in my life, again thanks for creating this video, love you, really helped me a lot!!
@gd6noob
@gd6noob 4 жыл бұрын
Always loved watching your videos. Just a quick question. How can I adjust this to lets say I want Columns A, C to E.
@chrish281
@chrish281 5 жыл бұрын
I'm far from a newb with VBA and I'm still learning some things I didn't know from your vids, thanks! Question : I see you use .value I have always been told to use value2 because it is allegedly faster and gives the underlying value...thoughts?
@Excelmacromastery
@Excelmacromastery 5 жыл бұрын
I use Value for almost everything and I never have a problem. There may be specific cases where you need it: "The only difference between this property and the Value property is that the Value2 property doesn't use the Currency and Date data types." -docs.microsoft.com/en-us/office/vba/api/excel.range.value2
@dougdevine27
@dougdevine27 5 жыл бұрын
Value2 seems to be faster (for all types) and safer (for currencies and dates): fastexcel.wordpress.com/2011/11/30/text-vs-value-vs-value2-slow-text-and-how-to-avoid-it/ I recreated the analysis in that blog with similar favorable metrics for Value2 over Value.
@chrish281
@chrish281 5 жыл бұрын
​@@dougdevine27 Thanks, good link...I'll stick to using value2...but I'm sure for most real world cases it makes little difference
@kanjenplays3946
@kanjenplays3946 11 ай бұрын
Hello, Thanks for this tutorial. However, my problem here is that it can't include data after blank row or blank column. Any tips? Thanks
@mthwmwn7844
@mthwmwn7844 4 жыл бұрын
Great video as usual. Quick one. I've been coding VBA for approx 5 years and consider myself a moderate to advanced user. One thing I encounter when setting ranges and pasting arrays back it pastes values and I loose formulas. Is there a method of inputting formulas into the array when it is pasting back out?
@mangobrother
@mangobrother 5 жыл бұрын
Thank you so much. Great video. I am learning a lot. Very useful tips.
@ShivaKumar-xo4hw
@ShivaKumar-xo4hw 4 жыл бұрын
Thanks for your Awesome Video Sir. We are selecting the around 5 columns in array and copy, pasting it to different columns arr with same 5 columns. But I have different scenario. So my question is can I select 5 columns in array, copy, paste only any 3 column Eg. Column A, B, E.. Only by using array. Please help me Or Give me alternate idea
@eduarchavarria
@eduarchavarria 4 жыл бұрын
This is a fascinating topic. I think I can adapt this to copying non-contiguous ranges from one workbook to another, but I'm not quite sure.
@henrikijonkoping4694
@henrikijonkoping4694 4 жыл бұрын
You can @ Eduardo Chavarria
@vijaysahal4556
@vijaysahal4556 4 жыл бұрын
superb sir
@NabhdeepBansal
@NabhdeepBansal 3 жыл бұрын
Hello. Wonderful lecture! Thanks. My question: is there a way by which I store my database table in an array when my workbook opens AND use/call the array at different times wherever required??
@WieEiPiehGuy
@WieEiPiehGuy 5 жыл бұрын
Thanks, very informative. I have a question though: How do I manage to format my cells to achieve a good layout? My current Excel sheet is rather slow as I copy a row and insert it, but with this (slow) technique I don't have to care about number/text/date/currency formats or cell formats (yellow background, bold numbers) etc. as Excel takes care of that for me. Should I work with arrays and after my "tables" are filled with data, another macro formats the cells according to my wishes? Or is there another approach?
@WieEiPiehGuy
@WieEiPiehGuy 5 жыл бұрын
I "tweaked" my Excel spreadsheet and was able to speed up the operations by a factor of 17 (of course, I did not use 'select' and similar bad techniques from the start). I did this by using arrays and, instead of adding one row per operation, added all the needed rows at once and inserted the array contents into those empty with one go. The format of the cells (styles, number formats, borders...) is fixed at the end for the entire "table". Thanks :)
@oskarbjorling996
@oskarbjorling996 2 жыл бұрын
Is there an effective way to use the same array approach to also copy and transfer the cell format to the new range?
@shrutikadongre1046
@shrutikadongre1046 2 жыл бұрын
Thankyou so much for this tutorial, really helped me a lot! and saved my time.. thanks a lot yet again!! :))
@imboom-
@imboom- Жыл бұрын
Thanks for the video, Paul! I had a question! I'm looking to copy all the info from a sheet and paste it to another sheet. Based off the indent value of a second column, I will offset it on a row in the new sheet(higher indent = higher offset, indentlevel 1 goes to A:D on row 1, indentlevel 2 goes E:H on row 2, ect) then continue through the entire sheet. I'm seeing if I can apply this to that but the problem is my first row has an embedded link.. is there a way to add that into the array and keep the link as well when it gets pasted?
@RICARDOHERNANDEZ-rf3ug
@RICARDOHERNANDEZ-rf3ug 2 жыл бұрын
Hello i have one column that contains filenames in unicode, but when i assign the range to the array, the array don't have the true filename, it seems like be in ansi encoding, what can i do in order to get the true names in the array?
@jawalim1996
@jawalim1996 4 жыл бұрын
amazing video, thanks, you are my best vba mastery legend.
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
Wow, thanks
@121960864
@121960864 7 ай бұрын
thank you very much!
@힐베르토
@힐베르토 5 жыл бұрын
Paul, Thank you for great instruction. Is it possible if I do samething with a recordset pulled out of query?
@bonniebaker6226
@bonniebaker6226 2 жыл бұрын
Loving your videos. A lot of my data is in word documents and I want to use VBA to move it to excel. Is there a similar way to copy a word table into an array without looping through all cells or using a copy/paste command?
@wattjock2405
@wattjock2405 4 жыл бұрын
Thanks for the video on Arrays. The application i am build relies heavily on arrays and this is simply explained and very helpful for a Novice VBA user! Somewhere else I learned that you should release your variables after the end of the Sub. e.g.: "Set arr = Nothing" Is this true?
@Excelmacromastery
@Excelmacromastery 3 жыл бұрын
You only use Set for objects like Collections, Ranges etc. You don't use it for arrays. In general it is good practice.
@wattjock2405
@wattjock2405 3 жыл бұрын
@@Excelmacromastery ~ That explains it, thanks!
@ScienceNotFaith
@ScienceNotFaith Жыл бұрын
I know this video is old. But want to ask this question of you or anyone who reads it. Is there an equivalent query-generating function/feature for Excel like there is for MS Access? That one is so slick and easy to use. I want to have a table of categories with multiple columns from which criteria can be set to filter only those that meet or exclude them. I don't see a way to easily do that in Excel. If not, can you create a video on how that's done? Thanks.
@michaelalbry
@michaelalbry 2 жыл бұрын
This is a minor thing: My attempt to transfer range logic to array logic failed, because I used "for each"-loops to access the cells in the range. This is not working. So I just have to rebuild my code around two dim array logic. The speed gain is still unbelievable, and I am more than grateful for this contribution. Originally I thought that for each logic should work as in the following code e seems to be a reference to the range/cell element: for each e in myRange e.value="Changed" next e. This would result in a cell value of "Changed" throughout the whole range. Any suggestion, how to transfer that?
@lindsaydempsey5683
@lindsaydempsey5683 3 жыл бұрын
Can you have a UDF in an Add-in and extract information from a named range within the same Add-in from one of the internal worksheets? Or is the vba module the only part of the Add-in that can be used/accessed?
@CORRETORCINTRON
@CORRETORCINTRON 4 жыл бұрын
Excellent video.!!!!!!!!!!!!!
@Excelmacromastery
@Excelmacromastery 4 жыл бұрын
Thank you very much!
@niczoom
@niczoom 4 жыл бұрын
Great tips, thanks!
@jeffgrant6004
@jeffgrant6004 Жыл бұрын
Fatastic video. Thanks
@rewatiraman2956
@rewatiraman2956 2 жыл бұрын
for quit some time , i am following vba tutorials, i have in dilema, can we find particular cell value from other sheet into other sheet and then cut this cell value and find differenct cell value in same column and paste this cell value below this, thorough this methond
@LPAtkins
@LPAtkins 5 жыл бұрын
Thanks for uploading this Paul.
@pentatradeagency3343
@pentatradeagency3343 2 жыл бұрын
Sir, Thanks for uploading such nice videos on very basic yet foundation to onward VBA coding. Sir, unfortunately when I run codes, error message pop out. The error message contain a "Run-time error 13 Type Mismatch". Please advice me on correct the error. Lots of love to your continued efforts. Keep going, Sir.
@csemanate
@csemanate 5 жыл бұрын
Learning a lot. Thanks!!
@verkar1965
@verkar1965 4 жыл бұрын
hi thanks for your videos... is it possible to redim preserve arr(1 to x,1) when arr is a variant ? thanks
@frikduplessis3869
@frikduplessis3869 5 жыл бұрын
Thank you Paul a brilliant video again,
@HectorLHG
@HectorLHG 5 жыл бұрын
Amazing explanation! Congrats!
How to make your Excel VBA code run 1000 times faster
16:55
Excel Macro Mastery
Рет қаралды 366 М.
10 Years of VBA Array Knowledge in 40 Mins
41:57
Excel Macro Mastery
Рет қаралды 26 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Многоуровневая сортировка массивов в VBA: разбор примера
24:23
Билял Хасенов – Excel, VBA & More
Рет қаралды 29 М.
Excel VBA Introduction Part 25 - Arrays
1:00:24
WiseOwlTutorials
Рет қаралды 230 М.
Watch these 28 minutes if you want to become an Advanced VBA user...
29:01
Excel Macro Mastery
Рет қаралды 57 М.
Create Excel Workbooks Worksheets Automatically with Excel VBA Arrays
10:05
5 Killer Excel VBA Tips Everyone Should Know
12:55
Excel Macro Mastery
Рет қаралды 111 М.
How to Use Class Interfaces in Excel VBA
20:16
Excel Macro Mastery
Рет қаралды 83 М.
Excel VBA Collections: Collections vs Arrays (4/5)
15:14
Excel Macro Mastery
Рет қаралды 59 М.
Python in Excel vs. VBA - What You Should Learn in 2024!
10:05
David Langer
Рет қаралды 80 М.