+ Reply to Thread
Results 1 to 6 of 6

VBA tutoring

  1. #1
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    VBA tutoring

    I am not asking for my homework to be done for me but I have spent many hours trying to answer the below questions and have not got very far.
    Please can someone help or advise me on how to answer these as I am studying an open university course and this is very important to me.

    MethodwhereIsTheShelf(shelfNumAsInteger)AsString
    outputAsString SetoutputTo "Thisshelfisinthe" SelectCaseshelfNum
    Case1To 19:SetoutputTo output+"study"
    Case19To 20:SetoutputTo output+"kitchen" Case21:SetoutputTo output+"bedroom"
    Case23To 40:SetoutputTo output+"lounge" EndSelect
    Returnoutput
    EndMethod

    (a) What stringwill be returned if theinput argument is 10?

    (b) What stringwill be returned if theinput argument is 22? Briefly explainyour answer
    (c)What stringwill be returned if theinput argument is 19?
    Explainwhy thestringreturned will not containthe word ‘kitchen’,that is,explain whythe second case is not executed
    d) What stringwill be returned if theinput argument is 41?
    Last edited by sara1989; 01-11-2015 at 11:54 AM. Reason: Help with homework

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: OPEN UNIVERSITY VBA HELP asap

    Hi sara, welcome to the forum

    Nothing is more frustrating than to be working on homework and to get stuck. Without guidance, you might have no hope of finishing the assignment before the deadline. The Internet can be a big help in that respect, but without learning how to get the right answer, asking others to solve your homework questions for you simply becomes a downward spiral (and it's cheating).

    We do not want to contribute to you cheating yourself out of your education, but we also acknowledge that seeking assistance to learn a concept is a legitimate request.

    If you are genuinely interested in receiving help in the form of tutoring or coaching, then please rephrase the title of your original post to clearly indicate you are seeking coaching or tutoring help. Any forum members (who are willing to assist as a tutor) will modify their responses accordingly to facilitate your learning. Tutors don't tell you the answers, they help you figure it out for yourself; so don't expect answers, expect suggestions, or just plain hints. Also, be specific in describing the function/formula or technique you trying to learn, and tell us what you have attempted so far. Otherwise, expect your plea for homework answers to be ignored.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-11-2015
    Location
    COSELEY
    MS-Off Ver
    WINDOWS 8
    Posts
    57

    Re: OPEN UNIVERSITY VBA HELP asap

    I am not asking for a plea this is certainly the last resort. as you can imagine I have tried searching for help to explain how I can solve these answers but still with no luck. so hence the reason I am asking some to explain the answer for each question so I have an understanding of how and where they reach the answer.

    I would like someone to explain and teach me further this is not just a easy way to cheat.

  4. #4
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA tutoring

    I can assist, what questions do you have?

  5. #5
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA tutoring

    (Continuation of PM posted here for posterity):

    Ok, looking at the code, it looks like the method is utilizing a "switch/case" statement, Consider the following...

    Outside of the switch case, the method is setting SetoutputTo to the value "Thisshelfisinthe" (a string value). Regardless of the argument passed to the method, i.e. MethodwhereIsTheShelf([Our Integer Being Passed]), the base string will always be "Thisshelfisinthe".

    Now, depending on the integer argument passed to the method "MethodwhereIsTheShelf" another string will be added onto the end (concatenated) of "Thissehflisinthe".

    The line of code #4 "SelectCaseshelfNum" is starting a "select/case" block. If we examine the following lines of code until "EndSelect" we can see the following.

    If the integer passed is between 1 and 19, we will add "study" to the end of our string (effectively creating a new string, and storing it in "SetoutputTo" with value "Thisshelfisinthestudy")

    The same applies for the remaining "cases", if the integer passed is between 19 and 20, we will add "kitchen" to our string.

    If the integer passed does not meet the logical criteria for any of our cases, no string will be concatenated to our base string, and the output will return "Thisshelfisinthe".
    Last edited by 1aaaaaaaaaaaaaaa; 01-11-2015 at 12:38 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: VBA tutoring

    (Updated code)

    Please Login or Register  to view this content.

+ 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. [SOLVED] Amateur Excel User Needing Help On First University Assignment
    By JoeSmart in forum Excel General
    Replies: 9
    Last Post: 10-07-2013, 05:59 PM
  2. Graduating university soon! Let's keep learning excel!
    By blitzcrag in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-03-2013, 01:35 AM
  3. Replies: 1
    Last Post: 12-22-2011, 10:10 AM
  4. Sum calculations for university
    By Amnesiac in forum Excel General
    Replies: 6
    Last Post: 09-24-2010, 05:38 PM
  5. Urgent (University) Please Help m with an EXcel Function
    By aaronjason8992 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-26-2008, 06:24 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