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

Поділитися
Вставка
  • Опубліковано 15 гру 2024

КОМЕНТАРІ • 151

  • @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

  • @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..

  • @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

  • @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

  • @babzo1
    @babzo1 10 років тому

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

  • @digitalmohsin
    @digitalmohsin 5 років тому +5

    Its 2019 and this tutorial is still relevant.

  • @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!

  • @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!!!

  • @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

  • @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!

  • @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

  • @excelisfun
    @excelisfun 11 років тому +1

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

  • @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!

  • @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!

  • @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

  • @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!

  • @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

  • @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)?

  • @SafeAndEffectiveTheySaid
    @SafeAndEffectiveTheySaid 11 років тому

    Thanks for helping with these amazing tutorials!

  • @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!

  • @pisethyoy
    @pisethyoy 9 років тому

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

  • @stealthwolf1
    @stealthwolf1 9 років тому +14

    Alfred?

  • @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

  • @ermurali01
    @ermurali01 11 років тому

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

  • @krn14242
    @krn14242 11 років тому

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

  • @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!

  • @caliboarder09
    @caliboarder09 6 років тому

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

  • @jamesperry3837
    @jamesperry3837 11 років тому

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

  • @Kararkson
    @Kararkson 11 років тому

    thank you. very informative and easily explained

  • @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 ?

  • @VarunSaxena_88
    @VarunSaxena_88 11 років тому

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

  • @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

  • @TheJakagiba
    @TheJakagiba 11 років тому

    Thanks very much for these great videos.

  • @mockreading5340
    @mockreading5340 8 років тому +1

    What's your email notifier program's name?

  • @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

  • @syedibrahim4012
    @syedibrahim4012 5 років тому

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

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 років тому

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

  • @mxrvxn08
    @mxrvxn08 3 роки тому

    thanks for this great tutorial!

  • @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?

  • @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

  • @benjokeks6765
    @benjokeks6765 2 роки тому

    Hello how can i use this code for xlookup thanks

  • @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?

  • @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

  • @ikebana8185
    @ikebana8185 6 років тому

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

  • @5adamjb
    @5adamjb 11 років тому

    Thanks for the videos Dan!

  • @doriswong9076
    @doriswong9076 8 років тому

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

  • @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.

  • @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

  • @kylerollins6483
    @kylerollins6483 8 років тому

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

  • @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?

  • @roshnisconcepts2640
    @roshnisconcepts2640 10 років тому +3

    I super like these videos.. Thank you ExcelVbaIsFun!

  • @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

  • @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

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 років тому

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

  • @jollyonlan
    @jollyonlan 11 років тому

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

  • @FrancescoCorrado83
    @FrancescoCorrado83 11 років тому

    Thank you for your videos.

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  11 років тому

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

  • @JanBolhuis
    @JanBolhuis 11 років тому

    Another great video. Thanks

  • @archanaaa2514
    @archanaaa2514 5 років тому

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

  • @abdulsafwan711
    @abdulsafwan711 4 роки тому

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

  • @zuaj3329
    @zuaj3329 6 років тому

    Love you, love excel! Thanks!!!!

  • @mostafasanad2273
    @mostafasanad2273 8 років тому

    Thanks very much, that was really helpful :)

  • @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

  • @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

  • @christianramos1875
    @christianramos1875 10 років тому

    Thank u bro!
    greetins from peru South america

    • @ExcelVbaIsFun
      @ExcelVbaIsFun  10 років тому

      christian ramos Hi glad to meet you!

  • @caliboarder09
    @caliboarder09 6 років тому

    Whats the meaning of Sub

  • @jimmyindahouse
    @jimmyindahouse 3 роки тому

    Do you have an email butler?

  • @nawarturk2932
    @nawarturk2932 10 років тому

    thx 4 ur efforts!

  • @MartB-tx5lb
    @MartB-tx5lb 5 років тому

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

  • @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!

  • @gerlynpolancovasquez5964
    @gerlynpolancovasquez5964 Рік тому

    GREAT VIDEO

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 років тому

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

  • @jitendervermavlogs746
    @jitendervermavlogs746 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...

  • @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

  • @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!!

  • @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. :)

  • @EverythingStacking
    @EverythingStacking 8 років тому

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

  • @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

  • @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

  • @MrSandeep1987
    @MrSandeep1987 10 років тому +1

    thank you for sharing sir.

  • @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?

  • @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

  • @jetpaq
    @jetpaq 10 років тому +1

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

  • @hazemali382
    @hazemali382 5 років тому

    many Thanks

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 років тому

    You're very welcome, Mike. de nada

  • @Arthurwxo
    @Arthurwxo 9 років тому

    Thank you so much!

  • @yayaboubaker6079
    @yayaboubaker6079 9 років тому

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

  • @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!! :)

  • @ExcelVbaIsFun
    @ExcelVbaIsFun  11 років тому

    Cool, thank you killingthecombover

  • @richardmelville5534
    @richardmelville5534 5 років тому

    Sorry... your video os blurry on the iMac

  • @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.

  • @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

  • @alejguz1552
    @alejguz1552 Рік тому

    lol what about that email notifier I need that one

  • @psraheja
    @psraheja 11 років тому

    Thanks

  • @ayazhussain3635
    @ayazhussain3635 7 років тому

    Thanks a lot sir.....

  • @trishansaha8485
    @trishansaha8485 2 роки тому

    LIKE, THANKS BRUH!

  • @TanvirAhmed1992
    @TanvirAhmed1992 7 років тому

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

  • @yulenalee
    @yulenalee Рік тому

    God bless you