View Full Version : problem with VBA code( Ambiguous name detected)
veronica2016
10-15-2015, 05:25 AM
HI EVERYBODY
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
You can't have two same eventprocedure in 1 codemodulte:
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)
remove 1 of these procedures.
I recommend that you only use Event Procedures to check conditions and select subs
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Condition1 Then SubA
If Condition2 Then SubB
End Sub
Or in your case
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$2:$E$2" Then ClearTextBox1
If Condition2 Then SubB
End Sub
Sub ClearTextBox1
TextBox1 = ""
[a5].AutoFilter
End Sub
SubB()
'
'
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.