+ Reply to Thread
Results 1 to 7 of 7

Excel VBA For Creative Problem Solving Part 1 Assignment 4

  1. #1
    Registered User
    Join Date
    12-18-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Excel VBA For Creative Problem Solving Part 1 Assignment 4

    VERY new to VBA, first class I have taken so far. I am getting Compile error: "Ambiguous name detected: identifier" when trying to run the assignment below. The assignment doesn't allow you to change the name of subs or functions. The "Identifier" is both a sub and a function. If I change the sub name to "IdentifierS I am able to F8 through the code fine. Is there a way to run the function as named or did I miss something? Thank you in advance.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-19-2023 at 08:38 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    I think it's reporting a problem because you have both a Sub and also a Function called Identifier.

    Change the name of one of them and it should be resolved.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  3. #3
    Registered User
    Join Date
    12-18-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    I agree with your response however the assignment prohibits changing the sub or function names as the grading file calls them specifically. I am sure there has to be a work around as the teacher has been knowledgeable and "tricky" with with small but significant bits of information. I am almost certainly sure this is a "test". I've watched all the lessons 3-4X over and can't find a clue to resolving this.

  4. #4
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    There may be some obscure way of overcoming this issue while using the same name for both a Sub and a Function- I don't know it (maybe something to do with class modules , I have zero idea).

    I'd personally check once with the teacher if it's at all possible to clarify if there's an error or not!

    EDIT- Another potential error is that the Sub Identifier uses nr to identify a numeric value but it assumes that the count of the content in column A is at least 2 cells (i.e. a minimum of 2 cells in column A have something in them), otherwise nr returns a zero or negative value, both of which trigger errors.
    Last edited by deadlyduck; 12-18-2023 at 05:52 PM.

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    Hi Astec,

    Welcome to the forum!!

    You can't have the same name for a macro and a function in the same module but if you put the Identifier function into its own standalone module (which I have called modFunctions) like so...

    Please Login or Register  to view this content.
    ...you can then call it from the Example macro like so:

    Please Login or Register  to view this content.
    To be consistent I'd also move the Key function into the modFunctions module and maybe rename Module1 as modCode.

    Regards,

    Robert
    Last edited by Trebor76; 12-18-2023 at 06:03 PM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  6. #6
    Registered User
    Join Date
    12-18-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    3

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    Moving it to module2 worked. Thank you very much!

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Excel VBA For Creative Problem Solving Part 1 Assignment 4

    Moving it to module2 worked. Thank you very much!
    You're welcome 👍

+ 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. VBA Excel part 1 Assignment 1
    By boonodno in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2023, 06:35 AM
  3. 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
  4. Kindly Help in Solving this Excel Problem
    By yousufsaleem in forum Excel General
    Replies: 1
    Last Post: 12-07-2015, 06:37 PM
  5. Need help in solving a problem using Excel 2007
    By newbieexcel123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2010, 12:59 PM
  6. [SOLVED] i've got a simple excel problem that needs solving...
    By Massive in forum Excel General
    Replies: 8
    Last Post: 05-16-2005, 04:28 AM
  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

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