+ Reply to Thread
Results 1 to 21 of 21

"Ambiguous name detected: FormatCell"

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    "Ambiguous name detected: FormatCell"

    Hello,

    I need my macros to search for the word "Cancel" in columns "T". Once found, I need the macros to make that entire row a certain pattern ( .Pattern = xlGray16)

    There will be other wording in these cells that contain "Cancel" or "Cancelled".

    A compile error keeps occurring. It says "Ambiguous name detected: FormatCell"..

    I'm confused with it..... any suggestions?

    Please Login or Register  to view this content.
    Thank you in advance for your help.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: "Ambiguous name detected: FormatCell"

    You have two copies of the sub in the module. Delete one.

    Or replace all the code with this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Thanks for the same reply. I received the exact same error message.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: "Ambiguous name detected: FormatCell"

    Search for FormatCell project-wide. There are two (or more) copies. Delete all but one.

  5. #5
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    those were the only two in the project i just Control + F 'd

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: "Ambiguous name detected: FormatCell"

    Post the workbook. You can delete all the data.

  7. #7
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    whats your email ill send you all of my code in the project

  8. #8
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    These are all of my subs:

    Could this have something to do with it?

    Please Login or Register  to view this content.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: "Ambiguous name detected: FormatCell"

    Delete all the data and post the workbook.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    re: "Ambiguous name detected: FormatCell"

    Hello copleyr,

    Please read the forum rules, especially about cross posting.
    Cross posted here

    Forum Rules
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  11. #11
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Please see attached
    Last edited by shg; 09-05-2009 at 11:02 AM. Reason: attachment removed at OP request

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    re: "Ambiguous name detected: FormatCell"

    Hello copleyr,

    Most forums don't mid if you cross post provided you add a link to the other sites. This helps everyone know were you are currently with answers and code. It helps prevent duplication of effort and wasting of time on the part of the posters.

    To Attach a File:
    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    re: "Ambiguous name detected: FormatCell"

    Hello copleyr,

    You have the following two Subs named the same in Module7. An easy way to avoid this in the future is to add the statement Option Explicit as the first line of the module. This will force you to declare your variables.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Thanks for the quick reply!

    I put "option explicit" before the sub on each sub that I listed. I still gave me the same error in the same place?

    any ideas?

  15. #15
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Please view attached screenshot.

  16. #16
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    re: "Ambiguous name detected: FormatCell"

    Hello copleyr,

    The rule is each sub inside the same module must be unique, i.e. the names must be different. Change the names of the subs. Add a number to each one if you want, so you have FormatCell1 and FormatCell2.

  17. #17
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Thanks Leith I surely appreciate your help. I will re word the names now.


    Sorry Shg, kind of new to macros.

  18. #18
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Hey all,

    I ended up being able to run the macros, but nothing worked. No row was set to this pattern.


    Any suggestions on how i can fix the code to get it to work?

    Thank you


    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Let me clarify,

    It will only work if it finds just the word "cancel" in the field and nothing else.

    I need it to find the word "cancel" or "cancelled" in what could very well be a sentence in the cell. After realizing that the words "cancel" or "cancelled" was in this sentence, I need it to highlight the entirerow.

    Is there a way I can do this?
    Last edited by copleyr; 09-05-2009 at 01:26 AM.

  20. #20
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    re: "Ambiguous name detected: FormatCell"

    Hello copleyr,

    This macro will replace the two in your previous post. It finds any form of "cancel" either as a word or in a sentence and grays the entire row when a match is made.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 09-05-2009 at 05:34 AM. Reason: corrected typo

  21. #21
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    re: "Ambiguous name detected: FormatCell"

    Thanks Leigh everything worked. I appreciate everything!
    Last edited by copleyr; 09-05-2009 at 10:48 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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