• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

problem with VBA code( Ambiguous name detected)

veronica2016

New Member
hi
I am delighted to join you in this forum. I have a problem with the vba code , when I click a message tells me "Ambiguous name detected"
please can you help me?
thank you in advance
 

Attachments

  • test2.xlsm
    119.2 KB · Views: 7
You have 2 Private Sub Worksheet_SelectionChange. You can have only one.

Combine your Worksheet_SelectionChange event into one.
 
thank you to answer me, but how ? i am very very weak in VBA
my code :
Code:
Option Explicit

Private Sub CommandButton1_Click()

End Sub

Private Sub ScrollBar1_Change()

End Sub

Private Sub TextBox1_Change()
    ActiveSheet.Range("b6").AutoFilter Field:=2, Criteria1:=TextBox1 & "*"
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$C$2:$E$2" Then
        TextBox1 = ""
        [a5].AutoFilter

    End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo MS
If Intersect(Target, Range("L39")) Is Nothing Then
Cells(844, 18) = Cells(844, 18) + Cells(39, 12)
MS:
Cells(39, 12) = ""
End If
End Sub
 
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$C$2:$E$2" Then
        TextBox1 = ""
        [a5].AutoFilter
    End If

On Error GoTo MS
If Intersect(Target, Range("L39")) Is Nothing Then
Cells(844, 18) = Cells(844, 18) + Cells(39, 12)
MS:
Cells(39, 12) = ""
End If
End Sub
 
Back
Top