+ Reply to Thread
Results 1 to 7 of 7

Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

  1. #1
    Registered User
    Join Date
    09-20-2024
    Location
    Madrid
    MS-Off Ver
    16.52
    Posts
    12

    Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Hi all

    I am trying to improve my skills with excel/VBA as I need it for my job. I started the course Excel/VBA for Creative Problem Solving, Part 1 in coursera and I am on module 2.
    As far as I can see, my macro is correct. It works for me in my PC, but for some reason its failing in part C. Please, could you help me find what I am doing wrong?
    x100000 thanks.

    The exercise says the following

    INSTRUCTIONS:

    a) Create a subroutine called AddNumbersA that adds a number input into an input box to the value in cell D4. The result should be output in cell G12.

    b) Create a subroutine called AddNumbersB that asks the user for a number, adds that number to the value in the active cell, then places the result in a cell that is 3 rows up and two columns right of the active cell. (Make sure that you select an appropriate active cell prior to running the sub!)

    c) Create a subroutine called WherePutMe that asks the user for a row number and column letter then places the 2,2 position of a selection into that cell. (HINT: Make sure that you select a selection before running the sub!)

    HINT: If x is an integer and is equal to 7 and y is a string and equal to "B", you can place z into cell B7 by: Range(y & x) = z. Hope this helps.

    1. Start with a selection:
    2. Run your WherePutMe subroutine, which asks the user for the row and column of the cell in which they’d like to place the result:
    3. Your subroutine will take the 2,2 position of the initial selection (-4 in our example) and place it in cell C7 (specified by user in the two input boxes):


    d) Create a subroutine called Swap that will swap the values in two adjacent cells (in the same row, anywhere on the spreadsheet). (Make sure that you select two adjacent cells before executing the sub!).

    And my code is this

    Please Login or Register  to view this content.
    Can you guys please help me? I have also attached the file.

    Thanks a lot
    Attached Files Attached Files
    Last edited by MeryFlower.1983; 10-12-2024 at 03:26 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,012

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    If my understanding of the task is correct then perhaps this?
    Please Login or Register  to view this content.
    BSB

  3. #3
    Registered User
    Join Date
    09-20-2024
    Location
    Madrid
    MS-Off Ver
    16.52
    Posts
    12

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Hi BSB
    Thanks for your response. Just tried your code and its not doing what it is supposed to do.

    The exercise is the following (as I understand it)
    1. request a row number
    2. request a column letter
    3. select value in the obtained cell reference
    4. copy value of the referenced cell ofsetting it 2,2

    No?

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,012

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Ah OK, I only read the one line you had highlighted in red previously and not the extra bit now highlighted.

    Perhaps this then?
    Please Login or Register  to view this content.
    BSB

  5. #5
    Registered User
    Join Date
    09-20-2024
    Location
    Madrid
    MS-Off Ver
    16.52
    Posts
    12

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Just as I was replying to you I realize I had misunderstood the assigment
    I think the correct answer is

    Please Login or Register  to view this content.

    The grader is still saying that it is not correct, but it must be... Copies the value of Cell 2,2 of the selection and paste it cell C7...

    i am very confused
    Last edited by AliGW; 10-12-2024 at 02:59 AM. Reason: Code tags added - please review the forum guidelines.

  6. #6
    Registered User
    Join Date
    09-20-2024
    Location
    Madrid
    MS-Off Ver
    16.52
    Posts
    12

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Hi I have added the grader file becuase in my opinion, it should say the macros are correct but it is not happening I really dont know where the mistake is. The macros work.

    To be able to grade the solution file, you need to save both of them in your local memory. Open the grade file, select the soltion file and press ok. Not sure why is not giving me a positive result.
    Attached Files Attached Files

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,790

    Re: Excel/VBA for Creative Problem Solving, Part 1 - Exercise nor succesful

    Administrative Note:

    We would very much like to help you with your query, however we recommend that you include code tags around your code.

    Please take a moment to add the tags in future. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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. Excel VBA For Creative Problem Solving Part 1 Assignment 4
    By chiky1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2025, 10:35 AM
  2. [SOLVED] Excel VBA For Creative Problem Solving Part 1 Assignment 4: Help Needed
    By chollerauer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2024, 02:39 AM
  3. Excel VBA For Creative Problem Solving Part 1 Assignment 4
    By YuliaUK in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-16-2024, 12:52 PM
  4. Excel VBA For Creative Problem Solving Part 1 Assignment 4
    By Astec in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-19-2023, 05:31 PM
  5. Help Needed: Excel VBA For Creative Problem Solving Part 1 Assignment 4
    By webcam723 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-04-2023, 08:28 PM
  6. Kindly Help in Solving this Excel Problem
    By yousufsaleem in forum Excel General
    Replies: 1
    Last Post: 12-07-2015, 06:37 PM
  7. Thorny VBA problem. Any creative solution appreciated.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2005, 06:06 AM

Tags for this Thread

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