Excel VBA Basics #3 - Using For and Next with variable, using loops for custom reporting

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

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

  • @Mikelom100
    @Mikelom100 11 ปีที่แล้ว

    I thought I knew a lot of Excel, then a realized it was Macros, so there's a new world to discover up, and you are helping me out with your videos. Thanks from México..

  • @jbp8417
    @jbp8417 6 ปีที่แล้ว +7

    Thank God, I found this channel. So blessed to have someone like you teaching us vba for free. God bless Sir

  • @shueybamin5244
    @shueybamin5244 3 ปีที่แล้ว +1

    Your videos are awesome my friend!
    3 videos in and already I have learned far more than books and paid courses could ever teach! Thank you for making VBA easy to follow

  • @renan6827
    @renan6827 7 ปีที่แล้ว

    Thank you ever so much. Your tutorial is excellent. I bought a book to learn VBA but your tutorials are so good that completely outweigh the book I bought. Furthermore, the way I learnt how to code was long, in the sense of write everything, for example worksheet ("sheet1"). Range () etc. Your way of writing is much better, so straightforward! I like it!. I tried to learn for and next in the book but I got so confused- with your example I finally learnt it!

  • @babzo1
    @babzo1 10 ปีที่แล้ว

    Thanks Daniel for taking your time in making this video. God bless you greatly.

  • @rajassy
    @rajassy 9 ปีที่แล้ว +1

    Another good video by Dan, and simple explanation and making it look all so easy, Good work.
    For the benefit of viewers, what they will learn in this video are
    - Loop For.. Next
    - Indenting to make easier reading
    - Performing calculation on variable
    - Date function and incrementing date
    - STOP - temporary pause to inspect the code run
    God Bless

  • @MYJETGLO
    @MYJETGLO 11 ปีที่แล้ว

    Hello Danny, Just want to say a sincere thanks for all your uploads and for the time and effort that you have input and shared with us all. Your quality of videos are excellent and just like Mike so is the detail level. Please keep this standard up. Thanks to you and Mike I am at last enjoying excel again!!!

  • @digitalmohsin
    @digitalmohsin 5 ปีที่แล้ว +5

    Its 2019 and this tutorial is still relevant.

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว +19

    Merry Christmas everyone. I hope God blesses you richly this upcoming year. Remember, you ARE a success!! Believe it, be it! Blessings my friends!! Dan

  • @evabrechtel4321
    @evabrechtel4321 2 ปีที่แล้ว

    Thank you so much! I can't wait to put my ideas into practice. I will be saving at whole lot of time!

  • @excelisfun
    @excelisfun 11 ปีที่แล้ว +1

    Amazing series of VBA Basic videos! Thanks, ExcelVbaIsFun!!

  • @killingthecombover
    @killingthecombover 11 ปีที่แล้ว

    Thanks for the videos, Dan!
    These are absolutely great.
    I've been trying to learn VBA for a few months now, and have been doing a little bit of coding at work, but your videos make everything very clear and I really appreciate that. Thanks again!

  • @quadroneuron
    @quadroneuron 11 ปีที่แล้ว

    Good job. Although I am yet to see some more advanced stuff but I like your channel as you are well descriptive and it is easy to understand

  • @alyismael91
    @alyismael91 6 ปีที่แล้ว

    This is awesome. I have been trying to learn excel VBA from sometime with on and off interest but I believe I can do it with this channel finally. Thank you ExcelVBAIsFun and Dan.

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  6 ปีที่แล้ว +1

      So glad to have you, Ali! We try to make it fun because we absolutely love Excel VBA and I find it to be absolutely engaging and addictive myself!

  • @witweerlig
    @witweerlig 10 ปีที่แล้ว +36

    Where can I get that email notifier !!??
    Its so cool!

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  10 ปีที่แล้ว +5

      for FREE my friend! Visit www.IncrediMail.com
      I really like modern versions of outlook better, but I used to use Incredimail and my dad still loves it. Cool backgrounds and emoticons are what incredimail is all about.
      Dan

  • @EliteKiller07
    @EliteKiller07 9 ปีที่แล้ว +1

    When I first started screwing around with VBA, I never used the For...Next loops. I never knew that existed.
    I always did it like this:
    x=1
    Do
    Cells(x, 1) = x
    x = x + 1
    Loop Until x = 11
    This is how I would loop through the first 10 rows. The For...Next loop looks much cleaner. Great video!

  • @FBharvest
    @FBharvest 10 ปีที่แล้ว

    Thank you very much Dan, and God bless you and your family Sir!

  • @octo314
    @octo314 9 ปีที่แล้ว

    Thank you for these videos, they are very informative and very easy to follow along!

  • @ermurali01
    @ermurali01 11 ปีที่แล้ว

    very informative and a learned a lot, looking for more videos

  • @Surya42930
    @Surya42930 11 ปีที่แล้ว

    Great work....to be encouraged by Mike and dedicating your knowledge to us..You are really amazing...Thank you very much from the bottom of the heart

  • @kaistasch4028
    @kaistasch4028 10 ปีที่แล้ว

    Thanks a lot, You explain it very easy. Greets from Germany

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  10 ปีที่แล้ว

      You're very welcome, Kai! thanks for the kind words!

  • @pisethyoy
    @pisethyoy 9 ปีที่แล้ว

    Thank you, you are great I can learn it easy for 3 lesson already! Thanks from Cambodia

  • @cscottodell
    @cscottodell 11 ปีที่แล้ว

    These videos are great. Please keep them coming. Do you have any videos focussed on importing stock data (more than just the price)?

  • @jamesperry3837
    @jamesperry3837 11 ปีที่แล้ว

    Excellent! vid tutorial Dan; & very interesting.
    I am learning a lot; in VBA basics.
    Thank u 4 sharing.

  • @SafeAndEffectiveTheySaid
    @SafeAndEffectiveTheySaid 11 ปีที่แล้ว

    Thanks for helping with these amazing tutorials!

  • @TheJakagiba
    @TheJakagiba 11 ปีที่แล้ว

    Thanks very much for these great videos.

  • @BDQUERY350
    @BDQUERY350 7 ปีที่แล้ว

    thank you for sharing this video and taking the time to explain us, I'm a bebinner in Vba but i'm working so strong

  • @mxrvxn08
    @mxrvxn08 3 ปีที่แล้ว

    thanks for this great tutorial!

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  3 ปีที่แล้ว

      You're very welcome, marvin!

  • @Kararkson
    @Kararkson 11 ปีที่แล้ว

    thank you. very informative and easily explained

  • @syedibrahim4012
    @syedibrahim4012 5 ปีที่แล้ว

    Thank you. for some great stuff. You explained everything very nicely.

  • @VarunSaxena_88
    @VarunSaxena_88 11 ปีที่แล้ว

    Hey superb videos.... I learnt alot from them.

  • @ikebana8185
    @ikebana8185 6 ปีที่แล้ว

    Thank you so much, your videos are so helpful^^

  • @StreetSpoken
    @StreetSpoken 11 ปีที่แล้ว

    these are real nice man! i'll be going through them slowly

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  11 ปีที่แล้ว

      Thanks Carmel!!

    • @StreetSpoken
      @StreetSpoken 11 ปีที่แล้ว

      i was wondering, do you have things like assignments or anything i could practice with? maybe ideas for small projects

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  11 ปีที่แล้ว

      Carmel Not yet but what a great idea! What did you have in mind? Do you have some ideas to challenge yourself that I can share with others? Like a contest or just assignment type things? Thanks, Dan

    • @StreetSpoken
      @StreetSpoken 11 ปีที่แล้ว

      Well, anything of that sort really. The point is I'm trying to learn for the sake of knowing at the moment, but just watching the videos is obviously not enough. I'd love any sort of assignments and a contest sounds like an ever better motivator.

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  11 ปีที่แล้ว +1

      Carmel Challenge #1 is uploading soon. lol You asked! Thanks Carmel. Dan

  • @krn14242
    @krn14242 11 ปีที่แล้ว

    Thanks Dan, where is that do while loop example? :)

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    After re-reading this, maybe you are talking about the font color, cause it starts black. Hmmm. . . please clarify for me specifically what you'd like. Thanks!! Dan

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    ?? Thanks, I'll take that under advisement. You're the first in 200K to mention this issue. Have a great day! Dan

  • @nid2010
    @nid2010 11 ปีที่แล้ว

    Thanks mate. Very grateful for the vids

  • @5adamjb
    @5adamjb 11 ปีที่แล้ว

    Thanks for the videos Dan!

  • @archanaaa2514
    @archanaaa2514 5 ปีที่แล้ว

    Super teaching sir
    How to do data entry using vba? How to enter coloum headers n rows in vba?

  • @caliboarder09
    @caliboarder09 6 ปีที่แล้ว

    How do you get the yellow circle and those red warnings. I don't get those on mine.

  • @christianramos1875
    @christianramos1875 10 ปีที่แล้ว

    Thank u bro!
    greetins from peru South america

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  10 ปีที่แล้ว

      christian ramos Hi glad to meet you!

  • @FrancescoCorrado83
    @FrancescoCorrado83 11 ปีที่แล้ว

    Thank you for your videos.

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  11 ปีที่แล้ว

      You're very welcome! Thanks for the comment and the "Likes"

  • @xcreame1991
    @xcreame1991 7 ปีที่แล้ว

    Hi, thanks for video, i have a question though, how to have each loop to execute (for example) to 5 rows? I noted in each loop u only apply to one cell.

  • @roshnisconcepts2640
    @roshnisconcepts2640 10 ปีที่แล้ว +3

    I super like these videos.. Thank you ExcelVbaIsFun!

  • @sadaqatali131
    @sadaqatali131 ปีที่แล้ว

    Hi i want to is there any option that we can disable the complete sheet from manual printing only if we click on the button/shape it will print ?

  • @jollyonlan
    @jollyonlan 11 ปีที่แล้ว

    Agree. This yellow circle is good when you watch the video in 120p :)

  • @mostafasanad2273
    @mostafasanad2273 8 ปีที่แล้ว

    Thanks very much, that was really helpful :)

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    I'm so glad to hear it drmaxwell, you're very welcome! Dan

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว +5

    Starting a new channel for Piano Lessons, learn by Chord and play by ear! Check it out here: How to Play Piano by Chord - Beginning Chords - C

  • @ermurali01
    @ermurali01 11 ปีที่แล้ว

    Hi Dan, thanks for your reply, I have a question, loops work fine if with a limited number of rows, if we have a big database of 20000 rows are more, and would like to count a specific number of times a variable occurs in database along with certain criteria which qualifies that variable in them same row, then place that count in a cell. can you help me with this. Murali

  • @JanBolhuis
    @JanBolhuis 11 ปีที่แล้ว

    Another great video. Thanks

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    Thanks ermurali01!! Please let me know if you have any suggested video topics OR questions. Dan

  • @zuaj3329
    @zuaj3329 6 ปีที่แล้ว

    Love you, love excel! Thanks!!!!

  • @stealthwolf1
    @stealthwolf1 9 ปีที่แล้ว +14

    Alfred?

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    Ok, will work on a vid. sounds interesting. I assume you're talking about the background color of the cell, not the Font color, yes?

  • @nawarturk2932
    @nawarturk2932 10 ปีที่แล้ว

    thx 4 ur efforts!

  • @yousuffarhan963
    @yousuffarhan963 8 ปีที่แล้ว

    Hi , I had a quick question. Let say I have a which contains the names of clients. Each client has on average 4 rows. However, the name is written on only the first row of that client. What can I do to make empty cells automatically fill with the name of the last filled row in that column?

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    Fantastic and you're super welcome! And thanks!!!

  • @mockreading5340
    @mockreading5340 8 ปีที่แล้ว +1

    What's your email notifier program's name?

  • @Craezy1992
    @Craezy1992 11 ปีที่แล้ว

    hey im working on a persenal administration file ware i want to make a cel that starts black and if you click it it gets red if you click it again it getst green and if you click it one more time it gets to blank again and its in a list of cels that are clicble each seperate of eachother any help would be realy apriciate ty

  • @dougls2564
    @dougls2564 ปีที่แล้ว

    Hello ExcelVbalsFun, I hope you are well. I have a question that I can not find the answer and I hope you can help. In your example "For x = 1 to 10". What if I wanted to be able to change the " 10 " element from the excel main sheet1. I am thinking like I would enter a value in a cell and the loop would run that many times. Or maybe a pull down or something. Any suggestions? Thank you

  • @gerlynpolancovasquez5964
    @gerlynpolancovasquez5964 ปีที่แล้ว

    GREAT VIDEO

  • @kylerollins6483
    @kylerollins6483 8 ปีที่แล้ว

    what would I do if I wanted to do root functions for the for and next functions?

  • @jetpaq
    @jetpaq 10 ปีที่แล้ว +1

    Well met sir..and Well done..thank you.Instant subscriber=me!

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  10 ปีที่แล้ว

      Cool. Glad to have ya, jetpaq!!

  • @benjokeks6765
    @benjokeks6765 2 ปีที่แล้ว

    Hello how can i use this code for xlookup thanks

  • @jitenderverma24
    @jitenderverma24 7 ปีที่แล้ว

    i like your videos , and i learn .i am beginer of vba . so its benefit for me.
    i face a problem on the chapter 3 ( for and next ) and loop . you have a any easy way to learn these chapter...

  • @cmenard1982
    @cmenard1982 11 ปีที่แล้ว

    I have some issues here. I'm using Excel 2010 and following the procedure in this video to its exact detail, and I'm getting error message "Compile Error - Variable not defined". Am I missing something here?

  • @abdulsafwan711
    @abdulsafwan711 4 ปีที่แล้ว

    How to insert formula for eg. =sum(A2:E2) or any vloopup formala

  • @romanvasiura6705
    @romanvasiura6705 9 ปีที่แล้ว

    Hello everyone!
    I have one question.
    Why not showing (at the video) Dim x as Integer???
    It is not properly.
    Can explain me this situation...
    Thank/

    • @uditkapoor2611
      @uditkapoor2611 7 ปีที่แล้ว

      I believe the reason is the Option Explicit button ON or OFF. He has it OFF for now, which do not make it mandatory for the user to declare the variable and vice-versa. Hope that helps. :)

  • @m_t_d2758
    @m_t_d2758 6 ปีที่แล้ว

    Hey !!! I am not able to get the excel VBA sample for this....please help.

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  6 ปีที่แล้ว

      Hi Mamoudou, I changed the link in the video description to excelvbaisfun.com/free-workbooks/
      Thanks
      Dan

  • @doriswong9076
    @doriswong9076 8 ปีที่แล้ว

    what's the use of NEXT in your above code?

  • @renan6827
    @renan6827 7 ปีที่แล้ว

    Oh Just one question. I don't like to use cell, I prefer to use range. So is it possible to use range instead of cell in the for and next ,? Because,I did try it but didn't work

  • @yayaboubaker6079
    @yayaboubaker6079 9 ปีที่แล้ว

    thanks you for that ; I am so thankfull (yaya from Algeria)

  • @MooseTheMoose
    @MooseTheMoose 5 ปีที่แล้ว

    Hi! I have a VBA question.
    I have a bar graph showing the the number of sales every month for the last 5 months.
    For example: 1000 in Oct, 1200 in Nov, 1300 in Dec, 950 in Jan, and 800 in Feb
    The Months are in One row (Row A), the number of sales are in another row (Row B).
    Next month, I want to show the number of sales for (Nov, Dec, Jan, Feb, March) on the graph. The month after, it would shift again (Dec, Jan, Feb, March, April) and so on
    And then keep on repeating that as months go by (looping)
    How would I code that loop on VBA?
    I'm aware of the fact that I can manually change the range, but we are trying to automate the system so that there is no manual work needed (and this code will go in between many other codes that I already have)
    Thanks for the help!

  • @mout001
    @mout001 6 ปีที่แล้ว

    Every Month I need to copy a range of data from one workbook to another workbook. In the column are the Months (Starting from April 18 till May 21). In the source file the Months are in row 2 (starting from E2, F2, G2, etc.) In the active file the Months are in row 5 (from CJ4, CK4, CL4, etc. till DU4).When the Month is ended I need to copy a range of 27 cells (row 3 till row 29) from the source file into the active file the column is based on the selected Month in cell (CI2) from the active workbook. The range is always 27 cells.So in the active workbook, I first select a Month (e.g. Aug 18) and then I click on a button to activate the copy function.At the moment I used IF, and ElseIf functions but this is a very long code. Can you help me to program a combination of a Vlookup with a loop function or something. There must be a much easier way to do this than I do now...right?Active Workbook Source file

  • @69memes98
    @69memes98 7 ปีที่แล้ว

    Hey ...I m interested in ur email notifier ... how do you do this ?

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  7 ปีที่แล้ว

      Hi Percy,
      www.incredimail.com has this ability. I use gmail nowadays or Outlook though for better functionality.
      Thanks
      Dan

  • @heathergray4880
    @heathergray4880 2 ปีที่แล้ว

    I wish VBA programmers would use indentation. It's not just to make it pretty. Indenting code properly is key to reading and understanding the function and flow of it

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  2 ปีที่แล้ว

      Agreed. It really causes headaches trying to figure out what's happening in a large loop with a gazillion embedded IF THEN statements. Thanks for the comment!! :)

  • @EverythingStacking
    @EverythingStacking 8 ปีที่แล้ว

    Is that your private youtube channel? I'm really respect of you.

  • @MartB-tx5lb
    @MartB-tx5lb 5 ปีที่แล้ว

    Can anyone say why this code doesn't work in Excel VBA 2003? Thanks

  • @MrSandeep1987
    @MrSandeep1987 10 ปีที่แล้ว +1

    thank you for sharing sir.

  • @tarvindersinghrandhawa1895
    @tarvindersinghrandhawa1895 11 ปีที่แล้ว +1

    when i write x = 1 i get an error complie error Variable not defined

    • @Chimmahhable
      @Chimmahhable 11 ปีที่แล้ว +2

      He probably has x defined as a Public object, meaning he can use that object anywhere. He probably should have mentioned that.
      To use x in this example you'd have to define it. Right under "Sub Test1()" put "Dim x as Integer"

    • @ikebana8185
      @ikebana8185 6 ปีที่แล้ว

      @@Chimmahhable Many thanks for your answer!!

  • @Arthurwxo
    @Arthurwxo 9 ปีที่แล้ว

    Thank you so much!

  • @jimmyindahouse
    @jimmyindahouse 3 ปีที่แล้ว

    Do you have an email butler?

  • @caliboarder09
    @caliboarder09 6 ปีที่แล้ว

    Whats the meaning of Sub

  • @ValmisFilm
    @ValmisFilm 6 ปีที่แล้ว

    can you use variable in the way that the for is changing the variable it self?:
    For k = 1 To 10
    something & k = k
    Next k
    Well, this does not work - why?

  • @hazemali382
    @hazemali382 5 ปีที่แล้ว

    many Thanks

  • @Craezy1992
    @Craezy1992 11 ปีที่แล้ว

    its like a activation button that i can use to activate modules inside excel to count ore not to count i can send you a file ore we can skype if you want to give you a beter explenation the code is below

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    Yes, that's do-able, but a sample would make better sense. Can you make a sample workbook to share with me? I can use the sample data to respond and make a video. Cool.

  • @ayazhussain3635
    @ayazhussain3635 7 ปีที่แล้ว

    Thanks a lot sir.....

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    Cool, thank you killingthecombover

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    If you're being forced to define your variable, you'll need to change your settings. It's EASY! Check out my video in my Basics Series. Video #17 is about that.The link is this, of course replacing dot with a period.
    youtube dot com/watch?v=Egf02zq95s8

  • @trishansaha8485
    @trishansaha8485 2 ปีที่แล้ว

    LIKE, THANKS BRUH!

  • @alejguz1552
    @alejguz1552 ปีที่แล้ว

    lol what about that email notifier I need that one

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 ปีที่แล้ว

    You're very welcome, Mike. de nada

  • @TanvirAhmed1992
    @TanvirAhmed1992 7 ปีที่แล้ว

    Nice tut, Thanks for you efforts. But there are too much "blah" in the video.

  • @yulenalee
    @yulenalee ปีที่แล้ว

    God bless you

  • @psraheja
    @psraheja 11 ปีที่แล้ว

    Thanks

  • @DeceptiveDesigns1
    @DeceptiveDesigns1 4 ปีที่แล้ว

    i'm still trying to understand why write VBA when you can create macros etc...

  • @SaratAnimation
    @SaratAnimation 6 ปีที่แล้ว +1

    lots of love

  • @richardmelville5534
    @richardmelville5534 5 ปีที่แล้ว

    Sorry... your video os blurry on the iMac