+ Reply to Thread
Results 1 to 9 of 9

How to Learn VBA

  1. #1
    Registered User
    Join Date
    12-15-2010
    Location
    Greenville, South Carolina
    MS-Off Ver
    Excel 2007
    Posts
    60

    How to Learn VBA

    Hello,

    This thread contains no code but I wasn't sure where else to ask. I have been reading this forum for months now and have tried to pick up techniques here and there as to writing vba code. I was wondering if any of you advanced/expert users could recomend a good way of learning VBA. Any help would be greatly appreciated!!

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: How to Learn VBA

    I think the best way is by contributing on this forum. Try to solve other user's issues. If you don't know something off the top of your head, look it up. A large number of the problems on this forum can be found by Googling the questions. A larger number just need a solution that can be found by Googling adapted to a specific situation. The best way to learn is to do it, and this forum provides a lot of opportunities for that.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: How to Learn VBA

    Decoderman
    I found the best way to learn was by identifying a project to complete.
    It doesn't really matter what the project is.
    As you work your way through and come upon problems this forum is amazing for helping you through in a very focused way.
    Your skills and knowledge build up over time and you can gauge your progress as your project progresses.
    When you complete your project you also get an amazing buzz of satisfaction.
    Thats why I try and help others on the forum
    A bit frustrating at first but ... it worked for me!
    A case of 1% inspiration and 99% perspiration - stick with it.

  4. #4
    Registered User
    Join Date
    12-15-2010
    Location
    Greenville, South Carolina
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: How to Learn VBA

    Thanks for the help guys. I have been reading the basics of VBA and trying to figure out answer on here for people. I am definately noticing it starting to stick a little faster. The biggest problem is just confidence in my code! Thanks for the pointer!

  5. #5
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: How to Learn VBA

    I learned VBA by doing several projects and just spending several hours a day going through forums, finding code I needed, and using it. But more importantly I'd try to understand the code. Eventually 'my' library and projects were enough that I could go back and reuse code I had worked with. Finally I got to the stage where I remembered the code and didn't have to look it up anymore.

    The point is it took a few weeks of just working with VBA to 'get it'. Still I find myself doing new stuff and I am required to come back here or other places to learn more.

    If you want a fun relatively easy project I'd do this.

    Create an excel workbook that lets you play the computer or another person in tic-tac-toe. Make it so you can choose to play a human or a computer, make a reset button, and also a counter that keeps track of how many wins player 1 or player 2 has. And do this all in VBA.
    Like barryleajo said above; "The best way to learn was by identifying a project to complete."

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: How to Learn VBA

    I would recommend to use the F1 button in the VBEditor as often as possible. Secondly use the F2 button in the VBEditor. Thirdly: use the macro-recorder to offer suggestions what kind of features vba/Excel contains. (Bur never use unadapted/reduced recorded code).

    Do not hesitate to read a book on VBA: Guy Hart Davis is easy to read.
    If you are coding yourself try to understand what the code does; in doing so you will get an impression of the fundamentals of the VBA language. That means: try to understand the logic of VBA's designers.
    Experiment with simpler code to test whether it still works or not and if so why, and if not why.

    Do not copy any code from 'googling', but use it to experiment with and to adjust it to your wishes.
    And you have to remind: analysing precedes organizing; organising precedes coding. Coding is only the last (least important) step in solving a task.
    Analysing, organizing and coding are circular processes: think from beginning to the end and from desired result to the start and do that several times. After you have 'finished' a project let it rest a few days; open it again and look at it as if someone asked to improve someone else's code. You will find that every 'finished' project is only a temporary step towards the result.

    Although some people may be satisfied with their code because 'it works', I prefer to be satisfied primarily with the methods with which the result is being attained. The more 'elegant' the code, the better in my view (but tastes in this respect vary considerably between VBA-users).



  7. #7
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: How to Learn VBA

    Quote Originally Posted by snb View Post
    Although some people may be satisfied with their code because 'it works', I prefer to be satisfied primarily with the methods with which the result is being attained. The more 'elegant' the code, the better in my view (but tastes in this respect vary considerably between VBA-users).
    What I found when learning was make the code work, but try to understand it and then improve it. One of the first things I learned from this forum was get rid of any code that contained .Select or .Selection to make things run quicker.

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to Learn VBA


  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: How to Learn VBA

    Another starting point to see the basics

    http://www.angelfire.com/biz7/julian...ans_macros.htm

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1