+ Reply to Thread
Results 1 to 14 of 14

ambiguous name detected

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    ambiguous name detected

    Hello. Looking for guidance on how to resolve the following. I know it's do to having the same name twice, but unable to figure out.


    Compile error:
    Ambiguous name detected: Worksheet_Change

    Private Sub Worksheet_Change (ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect (Target, Columns (30)) Is Nothing Then
    If Target.Value = 1 Then
    Rows (Target.Row) .Copy Sheets ("faOpenClaims") .Range("A" & Rows.Count) .End(3) (2)
    Rows (Target.Row) .Delete
    End If
    End If
    Application.EnableEvents = True
    End Sub

    Private Sub Worksheet_Change (ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect (Target, Columns (30)) Is Nothing Then
    If Target.Value = 3 Then
    Rows (Target.Row) .Copy Sheets ("faOpenClaims") .Range("A" & Rows.Count) .End(3) (2)
    Rows (Target.Row) .Delete
    End If
    End If
    Application.EnableEvents = True
    End Sub

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: ambiguous name detected

    Get rid of the second sub and change the line in the first sub to:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: ambiguous name detected

    Or

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: ambiguous name detected

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    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, it also maintains VBA formatting.

    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



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    You need to do the multiple test in the single event routine.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    Thanks walruseggman. Final question.

    When I enter 1 it goes to open, when I enter 3 it should go to close. Suggestion?

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: ambiguous name detected

    I don't understand what "it goes to open" and "it should go to close" mean. Can you be more specific?

  7. #7
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    I have 3 tabs: Claim, Open, Close

    When I enter 1 in specific column on claim tab, all data moves to open tab.
    When I enter 2 in same column on open tab, all data moves back to claim tab.
    When I enter 3 in same column on claim tab, all data moves to close tab.
    When I enter 4 in same column on close tab, all data moves to claim tab.

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: ambiguous name detected

    Example, hopefully you can extrapolate for the other scenarios:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    Getting Syntax error:

    Elself Target.Value 3 Then

  10. #10
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: ambiguous name detected

    You need an equals sign in there.

  11. #11
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    It's there. Same result

  12. #12
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    see attached if you wouldn't mind. entering data into column AD
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: ambiguous name detected

    You used a lower case "L" instead of an "I" in the if part of your ElseIf.

  14. #14
    Registered User
    Join Date
    08-27-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    17

    Re: ambiguous name detected

    There you have it. Thanks so much and have a great rest of your day.

+ 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. Ambiguous name detected...but why?
    By kocinela in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2012, 11:36 AM
  2. [SOLVED] Ambiguous Name Detected
    By stokie21 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2012, 11:01 AM
  3. Ambiguous name detected
    By antony moseley in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2010, 03:22 PM
  4. Ambiguous Name Detected
    By TonyforVBA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-11-2010, 01:33 PM
  5. Ambiguous name detected - please help
    By umax in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2006, 08:26 PM

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