How To Master Arrays In Excel VBA + FREE MACROS & CHEAT SHEET

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 55

  • @ExcelForFreelancers
    @ExcelForFreelancers  5 วันที่ผ่านมา

    😱 𝗨𝗡𝗕𝗘𝗟𝗜𝗘𝗩𝗔𝗕𝗟𝗘 𝟲𝟱% 𝗢𝗙𝗙 𝗧𝗛𝗜𝗦 𝗕𝗟𝗔𝗖𝗞 𝗙𝗥𝗜𝗗𝗔𝗬! 👉 www.excelforfreelancers.com/BFSale2024_YTPinnedComm

  • @enrikekasijas705
    @enrikekasijas705 7 หลายเดือนก่อน +4

    Arrays are the sickest and hardest elements 😂❤❤❤ can't wait!!!

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน +1

      Great, thanks so much and I am happy to help and share

    • @Info-God
      @Info-God 7 หลายเดือนก่อน +2

      Once you master Array you"ll need to learn Class for arrays (dynamic classes for arrays) , then Dictionary.

  • @SyedMuzammilMahasanShahi
    @SyedMuzammilMahasanShahi 7 หลายเดือนก่อน +4

    Thank you so much Randy for this amazing video.

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      For sure, you are very welcome Syed and thanks so much for your continued support

  • @Info-God
    @Info-God 7 หลายเดือนก่อน +4

    Arrays and loops are fundamental for advanced programming.

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Absolutely, one of my favorites. Thanks so much for sharing

  • @ashokanselliah9571
    @ashokanselliah9571 7 หลายเดือนก่อน +1

    Thank you very much Randy Sir for the wonderful explanation on the arrays

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      For sure, you are very welcome and I am happy to help and share

  • @mansoormohammed8718
    @mansoormohammed8718 7 หลายเดือนก่อน +1

    I subscribed and purchased one of your courses. You have a lot to give. You are an example of an individual who loves doing good and helping others. Congratulations on your wonderful soul

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Thank you so very much, I really appreciate that and I am really glad you enjoy the content and courses.

  • @pablomoreno2192
    @pablomoreno2192 7 หลายเดือนก่อน

    Are you planning to do videos of applications that work with office scripts? There is a real need of using applications for excel for the web and also application that can be run by multiple users at the same time (vba workbooks that are used at the same time by multiple users can give errors), and office scripts is the tool to avoid these inconveniences

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Hi and thanks. I would love to for sure, however Office Scripts are nowhere near being ready for that. For example worksheet/workbook change events and selection events do not exist in scripts as of yet, so as soon as the power is up to the VBA level I will be creating videos for scripts aw well. I hope this helps and thanks so much.

  • @enrikekasijas705
    @enrikekasijas705 7 หลายเดือนก่อน +2

    Great introduction to Arrays!!!😂❤❤❤ Thank you ❤

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Thank you so very much, I really appreciate that and glad you enjoyed the training.

  • @meka811
    @meka811 7 หลายเดือนก่อน +1

    Thank for you Randy for this excellent Video, I enjoyed learning about arrays,, but I am about to ask a crazy question,,, what font do you use for your vba coding?

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน +1

      Hi and thanks for your support. Its a nice question. I was not sure, so I had to look it up. its Arial (Western) Font Size 16.
      I hope this helps and thanks so much.

  • @ElectromecanicaIndustrial
    @ElectromecanicaIndustrial 7 หลายเดือนก่อน +4

    Learning arrays to optimize my VBA code

    • @Info-God
      @Info-God 7 หลายเดือนก่อน +1

      You must be very well organized from very begining to be able to use arrays. That's the trick.

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Great, thanks so much. I am happy to help and share

  • @andrewt207
    @andrewt207 7 หลายเดือนก่อน +1

    Excellent run through. I need to have a play with Arrays in VBA ... familiar with them in C/Python so this should be interesting.
    One question (I'm probably being dim) - in Sub DynamicBoundsArray(), why is the RowNumb = 34? The array is length 30, first (Excel) row 4 and last 33 (so not a +1 because it is zero to ...) why isn't it 33 as this is the final row processed [RowNumb = 4 to 33]?

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      HI and thanks, the item in an array is counted as 0 if its not specified so therefore the rows should always be 1 more than the array value. I hope this helps and thanks so much.

  • @akkintouch
    @akkintouch 7 หลายเดือนก่อน +1

    Thanks Randy as always great content.
    Possible to explain the filter array in Patreon?

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน +1

      Thanks so much. Yes its certainly possible. I checked it out and seemed a bit complicated for one of our Basic VBA tutorials but I will try to get it added into one of the more advanced lessons. Thanks for your continued support over the years.

  • @alializadeh8195
    @alializadeh8195 7 หลายเดือนก่อน +1

    Thanks

  • @Info-God
    @Info-God 7 หลายเดือนก่อน +2

    Dictionaries are another type of arrays.
    Listarrays is another powerful type of arrays.

  • @designexperience
    @designexperience 7 หลายเดือนก่อน +1

    Thank you Randy I'll try them...

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      For sure, you are very welcome and happy to help and share

  • @andrewmatt7731
    @andrewmatt7731 6 หลายเดือนก่อน +1

    In the 2DArray example, why are we able to omit the '()' parenthesis in the 'Dim TwoDArr as Variant' line? I am thinking it has something to do with the data type, 'Variant'.

    • @ExcelForFreelancers
      @ExcelForFreelancers  6 หลายเดือนก่อน +1

      Yes that is correct, as a variant, its a much more flexible variable than the others. Strings, Long or other variables need to be specified. Thank you for your Likes, Shares & Comments. It really helps.

  • @vannhiem8021
    @vannhiem8021 7 หลายเดือนก่อน +1

    Great! May you make a file for QA manager in a factory 🏭

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน +1

      Hi and thanks so much. This would be a custom job since its very specific. If you would like some help with this, we have a group with 60,000 Excel experts who would love the opportunity to customize this for you. Please join our Excel For Freelancers Facebook Group here: bit.ly/groupexcel (if you have not done so yet)
      You can then create a post and mark it as a PAID JOB, along with all of the details and requirements. Our members can then contact you and decide on how to best move forward with your project.
      I hope this helps and thanks so much.

  • @henkvinck888
    @henkvinck888 7 หลายเดือนก่อน +1

    amazing video THNX Randy

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Thank you so very much, I really appreciate that and glad you enjoyed the training

  • @venkateshreddy992
    @venkateshreddy992 7 หลายเดือนก่อน +1

    Hi sir. I have a problem in excel
    I have data that was downloaded from a software which is totally web based. In that excel all values are in text format including dates. If I give f2+enter that text will turn to proper date. But the problem is there are a lot of cells like in thousands. I tried converting to CSV. It works sometimes and sometimes it make the date to us format. Like 1/4/24 (1st April) will become 4th jan 24. Is there any VBA code that you can suggest to solve that issue

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Hi , Thanks for your comment. It would be difficult for us to help unless we see the specific bug you are running into. Can you upload screenshots of your bug and sheet into our Excel For Freelancers Facebook Group here: bit.ly/groupexcel We have 60,000 Members who would love to help you with this. Thanks so much.

  • @Info-God
    @Info-God 7 หลายเดือนก่อน

    Once you master Array you"ll need to master Class for arrays (dynamic classes for arrays) , then Dictionary.

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน

      Thanks so much for your continued support.

  • @SJGorilla
    @SJGorilla 3 หลายเดือนก่อน

    Is t it faster to use a For Next loop rather than a For Each loop? 1:09

    • @ExcelForFreelancers
      @ExcelForFreelancers  3 หลายเดือนก่อน

      I am not sure if its faster, however I prefer the For Next simply because of the clearly defined data set. I use for Each when I loop through objects such as Shapes, Worksheets or Workbooks. I hope this helps and thanks so much.

  • @kartickchakraborty9135
    @kartickchakraborty9135 7 วันที่ผ่านมา

    Hi Randy, how are you? Your explanation is superb. No one can explain these topics so easily. Randy, recently I've come across a problem like this. Would you kindly make a video on this topic - "How to split Strings that contain no Delimiter using User Defined Function in Excel VBA?" For Example, - You have some client names on your Sheet1 from Range("A2") to Range("A16"):
    Raw Data:
    ========
    Names First Names | Middle Names | Last Names
    ------------ -------------------- ------------------------ --------------------
    AlexanderWilliamJamesBrown
    AmandaTaylor
    AriaNguyen
    AubreyFoster
    AveryAnnPhillips
    Beerus
    BenjaminThomasHarris
    CharlotteMitchell
    ChristopherJackson
    DanielJamesMiller
    DavidAndrewJohnWilliams
    Dende
    DylanJamesWard
    ElijahWatson
    EllaSophiaRoberts
    ==========
    Here, some clients have First Names, Middle Names and Last Names (For Example: Alexander William James Brown etc.); some have First Names and Last Names (For Example: Amanda Taylor etc.) and some have only First Names (For Example: Beerus etc.). Now, I want to delimitate each name based on the Capital Letter. Desired Output mentioned below:
    Desired Output:
    =============
    Names First Names | Middle Names | Last Names
    ------------ -------------------- ------------------------ --------------------
    AlexanderWilliamJamesBrown Alexander | William James | Brown
    AmandaTaylor Amanda | | Taylor
    AriaNguyen Aria | | Nguyen
    AubreyFoster Aubrey | | Foster
    AveryAnnPhillips Avery | Ann | Phillips
    Beerus Beerus
    BenjaminThomasHarris Benjamin | Thomas | Harris
    CharlotteMitchell Charlotte | | Mitchell
    ChristopherJackson Christopher | | Jackson
    DanielJamesMiller Daniel | James | Miller
    DavidAndrewJohnWilliams David | Andrew John | Williams
    Dende Dende
    DylanJamesWard Dylan | James | Ward
    ElijahWatson Elijah | | Watson
    EllaSophiaRoberts Ella | Sophia | Roberts

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 วันที่ผ่านมา +1

      Hi and thanks very much. Yes it should be possible looping through the characters in a string and uusing the Asc code such as
      Function SplitByCapitalLetters(inputStr As String) As String
      Dim i As Integer
      Dim result As String
      result = Mid(inputStr, 1, 1) ' Start with the first character (always a capital letter)
      ' Loop through the rest of the characters in the string
      For i = 2 To Len(inputStr)
      If Asc(Mid(inputStr, i, 1)) >= 65 And Asc(Mid(inputStr, i, 1))

    • @kartickchakraborty9135
      @kartickchakraborty9135 6 วันที่ผ่านมา +1

      @ExcelForFreelancers Thank you Randy. You're the best VBA Trainer.

    • @ExcelForFreelancers
      @ExcelForFreelancers  6 วันที่ผ่านมา

      Thank you so very much, I really appreciate that

  • @Jojosmith342
    @Jojosmith342 7 หลายเดือนก่อน +1

    PLEASE SUBSCRIBE !! SUBSCRIBE TO RANDY'S HARD WORK, THE BEST VBA TEACHER ON TH-cam. Thumbs up 👍to his passion & dedication to teach. Thanks Randy for another excellent, valuable tutorial. God bless you!

    • @ExcelForFreelancers
      @ExcelForFreelancers  7 หลายเดือนก่อน +1

      Thank you so very much, I really appreciate that Jojo, so very kind of you. Thank you for your Likes, Shares & Comments. It really helps.

  • @kartickchakraborty9135
    @kartickchakraborty9135 6 วันที่ผ่านมา

    Look Randy, I've created a Dynamic Spilled Array Formulae that can split any Names that contain any number of Spaces as a Delimiter. Thank you very much for your priceless training. Next, I will try to create splitting Names that contain No Delimiter, splitting strings with Multiple Delimiters, splitting Text and Numbers from AlphaNumeric Characters and last but not the least, splitting the Domain Names from URL. (I've tried my best to align the Data here on TH-cam Comment Section. Please don't read this comment on your Mobile Phone as the alignments of text (Raw Data and Output) are not correct on Phone as they are on PC or Laptop.)
    Raw Data:
    ----------------
    Sr. No. Names First Names Middle Names Last Names
    001 Goku
    002 Amanda Taylor
    003 Alexander William James Brown
    004 Florian Henckel Von Donner Smarck
    005 Frieza
    006 Lily Grace Cooper
    007 Vegeta
    Output:
    ------------
    Sr. No. Names First Names Middle Names Last Names
    001 Goku Goku
    002 Amanda Taylor Amanda Taylor
    003 Alexander William James Brown Alexander William James Brown
    004 Florian Henckel Von Donner Smarck Florian Henckel Von Donner Smarck
    005 Frieza Friza
    006 Lily Grace Cooper Lily Grace Cooper
    007 Vegeta Vegeta
    Code:
    ---------
    Option Explicit
    Function SpilledArrayNamesByRange(InputRange As Range) As Variant 'Here, I set the Return Type of Function as Variant since it delivers an Array of Values.
    Dim SplitNamesBasedOnSpace() As String

    Dim MaxNameRow As Long
    MaxNameRow = InputRange.Rows.Count - 1

    Dim MaxNameColumn As Long
    MaxNameColumn = 2

    ReDim SplitNamesBasedOnSpace(0 To MaxNameRow, 0 To MaxNameColumn)

    Dim Cell As Range

    Dim CurrentRow As Long
    CurrentRow = 0

    For Each Cell In InputRange
    Dim NamePart() As String
    NamePart = Strings.Split(Expression:=Strings.Trim(String:=Cell.Value), Delimiter:=" ")

    If UBound(NamePart) = -1 Then 'Incase of Blank Cell, The UBound Array Function returns -1
    SplitNamesBasedOnSpace(CurrentRow, 0) = Empty
    SplitNamesBasedOnSpace(CurrentRow, 1) = Empty
    SplitNamesBasedOnSpace(CurrentRow, 2) = Empty
    ElseIf UBound(NamePart) = 0 Then
    SplitNamesBasedOnSpace(CurrentRow, 0) = NamePart(0)
    SplitNamesBasedOnSpace(CurrentRow, 1) = Empty
    SplitNamesBasedOnSpace(CurrentRow, 2) = Empty
    ElseIf UBound(NamePart) = 1 Then
    SplitNamesBasedOnSpace(CurrentRow, 0) = NamePart(0)
    SplitNamesBasedOnSpace(CurrentRow, 1) = Empty
    SplitNamesBasedOnSpace(CurrentRow, 2) = NamePart(1)
    ElseIf UBound(NamePart) = 2 Then
    SplitNamesBasedOnSpace(CurrentRow, 0) = NamePart(0)
    SplitNamesBasedOnSpace(CurrentRow, 1) = NamePart(1)
    SplitNamesBasedOnSpace(CurrentRow, 2) = NamePart(2)
    Else
    Dim Store As String 'Store comes into use when there are more than 2 (0 To 2) Name Parts (For Example: Florian Henckel Von Donner Smarck)

    Dim Counter As Long

    For Counter = 1 To UBound(NamePart) - 1
    Store = Store & " " & NamePart(Counter)
    Next Counter

    Store = Strings.Trim(String:=Store)

    SplitNamesBasedOnSpace(CurrentRow, 0) = NamePart(LBound(NamePart))
    SplitNamesBasedOnSpace(CurrentRow, 1) = Store
    SplitNamesBasedOnSpace(CurrentRow, 2) = NamePart(UBound(NamePart))
    End If

    Store = Empty
    CurrentRow = CurrentRow + 1
    Next Cell

    SpilledArrayNamesByRange = SplitNamesBasedOnSpace
    End Function

    • @ExcelForFreelancers
      @ExcelForFreelancers  6 วันที่ผ่านมา +1

      Wow that's amazing and a great idea! I look forward to seeing your solutions for all these other cases. I'm always amazed by the creative ways people use VBA.

    • @kartickchakraborty9135
      @kartickchakraborty9135 5 วันที่ผ่านมา

      @@ExcelForFreelancers Thank you Randy, it's all your credit. Without you, I am nothing.

    • @kartickchakraborty9135
      @kartickchakraborty9135 5 วันที่ผ่านมา +1

      @@ExcelForFreelancers If you're in my country, I'll personally contact to you. You're a great teacher and above all you're a great human being.

    • @ExcelForFreelancers
      @ExcelForFreelancers  5 วันที่ผ่านมา +1

      Thank you so very much, I really appreciate that