+ Reply to Thread
Results 1 to 16 of 16

Practice Exercises

  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Practice Exercises

    Hello. Does anyone know of a book or online resources that has a list of practice exercises for getting better at writing code? I can understand and sometimes tweak vba code but I've never been able to write it and I think practice exercises would help. Thanks.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Practice Exercises

    Have you looked at this yet?
    http://www.excelforum.com/excel-prog...materials.html
    There is a lot of different resources here.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Practice Exercises

    Hmm practice exercises. I don't think this has ever been asked for. Is there anything you are wanting to specifically learn how to do? I could probably give you some easy assignments that are typical scenarios you would encounter.

  4. #4
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    @ stnkynts. Yes, if you could give me a bunch of scenarios that would be awesome and maybe some hints as to how to accomplish them (type of logic to use etc.) I'd say my level is intermediate but I just can't write code haha Thanks!!

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Practice Exercises

    Ok here is Exercise 1 (which is a very typical question on this forum):

    I have 2 worksheets in a workbook named Sheet1 and Sheet2 respectively. In column A on Sheet1 I want to copy all cells that have a value of "copy me" to Sheet 2 column A. Please provide code.

    Hint: I went with this one first because there are about 20 ways you could accomplish this. Just focus on finding a method that works as requested in a reasonable amount of time. Report back if you get stuck or submit code when complete.

  6. #6
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    See, I have no idea This is the part that gets me. I can read code and understand it but constructing it is a whole another matter (unless I find the code online, which defeats the purpose).

    This is what I have so far, but it's not working. I know why (because selection doesn't select anything). Can you give me some tips? I also know it's an ineffecient way of doing this

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

  8. #8
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    I've come up with something better (with a little help from the internet). This is a start. Now I need to figure out how to get each selected range into "Sheet2" A1, A2, A3, etc. How do I add that loop in?

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    Thank you!!

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Practice Exercises

    You're welcome. Hope that helps.

  11. #11
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Practice Exercises

    Good find John.

    @OP. Very close.

    Please Login or Register  to view this content.
    Last edited by stnkynts; 03-11-2015 at 03:25 PM.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Practice Exercises

    Thanks stnkynts.

  13. #13
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    Thanks Stynx. Could you give me some alternative hints as to how solve the problem above (different logic, etc.) and I'll see how I can piece it together. Also, for some reason this code copies the first instance into A2 in the second sheet. Not sure why. Shouldn't it copy into the first row?
    Last edited by ammartino44; 03-12-2015 at 01:06 PM.

  14. #14
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Practice Exercises

    The above code will populate into A1, A2, A3, etc. If you look at the pastespecial line, it utilizes .End(xlUp) to find the last used row in column A and .Offset(1) to go to the very next line. Some alternative ways would be to use an autofilter or an array. Note: You can also write the range references and loops differently.

    Please Login or Register  to view this content.
    If you want to work on any of the practice exercises that John linked send me a PM and I will help you get through them.

  15. #15
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: Practice Exercises

    Hi stnkynts. Thanks for your response. The code copies into A2 to start because of the offset.

  16. #16
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Practice Exercises

    The code copies into A2 to start because of the offset.
    Good eye. Can you think of a way to write an "If Statement" to check if A1 is empty and if so paste to A1, if not paste to .End(xlUp).Offset(1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. The Net Has No Pivot Table Exercises - STRANGE!
    By omaral in forum Excel General
    Replies: 1
    Last Post: 12-25-2014, 04:17 PM
  2. Need Help With Some Basic Exercises in VBA
    By dirtysword in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2012, 10:17 PM
  3. VBA exercises tasks for newbees?
    By hunsnowboarder in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2008, 08:42 AM
  4. [SOLVED] VBA exercises
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2005, 08:06 AM
  5. Excel training - exercises
    By Louise in forum Excel General
    Replies: 2
    Last Post: 03-03-2005, 08:06 AM

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