Consulting

Results 1 to 6 of 6

Thread: VBA FOR BEGINNER QCM

  1. #1

    VBA FOR BEGINNER QCM

    Hi guys,

    I just started with vba in excel,
    does anyone know the answers of thise two questions?

    Question 1

    Marks: 1 Consider the following expression:

    switch(MyTest, MyVal1, True, MyVal2)

    Which of the following remarks about it is True?

    Choose one answer. a. it is exactly equivalent to iif(MyTest = MyVal2, MyVal1, True)
    b. it is exactly equivalent to iif(MyTest = MyVal1, MyVal2, True)
    c. it is exactly equivalent to iif(MyTest, MyVal1, MyVal2)
    d. it is exactly equivalent to iif(MyTest, MyVal2, MyVal1)
    e. it is exactly equivalent to iif(MyTest = MyVal1, True, MyVal2)

    Question 2
    Marks: 1 A variable MyVar is defined within a procedure called MyProc in a module called "Module 1".

    Dim MyVar as Integer

    Which of the following is most correct?

    Choose one answer. a. MyVar can be used within loops and branches within MyProc but nowhere else
    b. MyVar can be used anywhere within Module 1, but not outside the module
    c. MyVar can be used within the procedure MyProc but no where else
    d. MyVar can be used within the spreadsheet, but no where else

  2. #2
    Pleasse anyone?
    I need to submit the test in few minutes

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Jenny, we would be glad to discuss these things with you but since it's classwork, we can't just give you the answers.

    You should come here before it's just a few minutes till you take the test.

    Question 2 is so very basic that I'm surprised that you don't know the answer. If it's defined within a procedure then what does that tell you?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    To test the second question put this in a standard module and run it.

    You get a messagebox.

    [VBA]
    Sub test()
    Dim MyVar As String
    MyVar = "My Message"
    MsgBox MyVar
    End Sub

    [/VBA]

    Now make another sub but don't define MyVar. Just put the
    [VBA]MsgBox MyVar [/VBA]
    in the sub and run it. What happens?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Yikes.

  6. #6
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    What I want to know is what class is teach you to use switch and iif instead of select case and if?

    Btw at this point the answers I feel OK with telling you that answers are C & C.
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

Posting Permissions

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