Results 1 to 9 of 9

Compile Error: Ambiguous name detected

Threaded View

trubio77 Compile Error: Ambiguous name... 10-19-2017, 09:19 AM
Arkadi Re: Compile Error: Ambiguous... 10-19-2017, 09:25 AM
trubio77 Re: Compile Error: Ambiguous... 10-19-2017, 10:54 AM
Arkadi Re: Compile Error: Ambiguous... 10-19-2017, 09:26 AM
trubio77 Re: Compile Error: Ambiguous... 10-19-2017, 10:16 AM
Arkadi Re: Compile Error: Ambiguous... 10-19-2017, 11:24 AM
trubio77 Re: Compile Error: Ambiguous... 10-19-2017, 12:29 PM
trubio77 Re: Compile Error: Ambiguous... 10-19-2017, 02:02 PM
Arkadi Re: Compile Error: Ambiguous... 10-19-2017, 02:26 PM
  1. #1
    Registered User
    Join Date
    10-11-2017
    Location
    San Antonio, TX
    MS-Off Ver
    7
    Posts
    41

    Compile Error: Ambiguous name detected

    Hello,

    need some assistance

    I keep getting the following Compile Error

    "Ambiguous name detected: Worksheet_Change"

    here is the code that I run:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rng1 As Range, c1 As Range, r As Integer
        Dim rng2 As Range, c2 As Range, c As Integer
        Dim s1, s2
    
        If Not Application.Intersect(Target, Me.Range("F5,G5")) Is Nothing Then
            s1 = Range("F5").Value
            s2 = Range("G5").Value
    
            Set rng1 = Range("C9:C12")
            Set rng2 = Range("E7:CT7")
            On Error GoTo er
            For Each c1 In rng1.Cells
                If c1 <= s1 And c1.Offset(, 1) >= s1 Then
                    r = c1.Row
                End If
            Next c1
    
            For Each c2 In rng2.Cells
                If c2 <= s2 And c2.Offset(1) >= s2 Then
                    c = c2.Column
                End If
            Next c2
    
            Range("H5").Value = Cells(r, c).Value
        End If
        Exit Sub
    er:     MsgBox "Not a valid entry"
    End Sub
        
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rng1 As Range, c1 As Range, r As Integer
        Dim rng2 As Range, c2 As Range, c As Integer
        Dim s1, s2
    
        If Not Application.Intersect(Target, Me.Range("J5,K5")) Is Nothing Then
            s1 = Range("J5").Value
            s2 = Range("K5").Value
    
            Set rng1 = Range("C13:C16")
            Set rng2 = Range("E7:CT7")
            On Error GoTo er
            For Each c1 In rng1.Cells
                If c1 <= s1 And c1.Offset(, 1) >= s1 Then
                    r = c1.Row
                End If
            Next c1
    
            For Each c2 In rng2.Cells
                If c2 <= s2 And c2.Offset(1) >= s2 Then
                    c = c2.Column
                End If
            Next c2
    
            Range("L5").Value = Cells(r, c).Value
        End If
        Exit Sub
    er:     MsgBox "Not a valid entry"
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rng1 As Range, c1 As Range, r As Integer
        Dim rng2 As Range, c2 As Range, c As Integer
        Dim s1, s2
    
        If Not Application.Intersect(Target, Me.Range("N5,O5")) Is Nothing Then
            s1 = Range("N5").Value
            s2 = Range("O5").Value
    
            Set rng1 = Range("C17:C20")
            Set rng2 = Range("E7:CT7")
            On Error GoTo er
            For Each c1 In rng1.Cells
                If c1 <= s1 And c1.Offset(, 1) >= s1 Then
                    r = c1.Row
                End If
            Next c1
    
            For Each c2 In rng2.Cells
                If c2 <= s2 And c2.Offset(1) >= s2 Then
                    c = c2.Column
                End If
            Next c2
    
            Range("P5").Value = Cells(r, c).Value
        End If
        Exit Sub
    er:     MsgBox "Not a valid entry"
    End Sub
    Last edited by trubio77; 10-19-2017 at 10:15 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Compile Error: Ambiguous name detected:Test
    By dalewms2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2014, 03:37 PM
  2. Compile Error Ambiguous name detected worksheet_change
    By OwnDizzzld in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-20-2014, 09:17 AM
  3. Compile Error : Ambiguous name detected
    By vasanthrs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2013, 09:58 AM
  4. VBA Compile Error: Ambiguous name detected
    By kieranoduill in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2013, 05:31 PM
  5. [SOLVED] compile error ambiguous name detected worksheet_change
    By MAttTaylor87 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2013, 07:07 AM
  6. [SOLVED] compile error ambiguous name detected!?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2013, 08:49 PM
  7. Compile error: Ambiguous name detected
    By Aletha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2008, 05:48 PM
  8. Compile Error: Ambiguous Name Detected: Workbook_Open
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-19-2008, 10:46 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