Capy_Uther
New Member
- Joined
- May 14, 2023
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hello to everyone guys i would like to add the following to my excel
I have a Page called "Vendedores" with the following table: ( On this table i have all the information i need)
On a second page Called "pag1" i have a drop down list with the information on the table before
The thing with this table is that on the Drop Down menu i can see the names, but if i choose a name instead of show the name on that cell "N2" it shows the number
Example if i choose Kevin Oliveros instead of show the name it will show the number 12 because is the number on the table for that name.
For this to work i use the follow code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Changed As Range, c As Range
Set Changed = Intersect(Target, Range("N2")) '<- Edit range as required
If Not Changed Is Nothing Then
Application.EnableEvents = False
For Each c In Changed
If Len(c.Value) > 0 Then
c.Value = Sheets("Vendedores").Range("A2:A500").Find(What:=c.Value, LookAt:=xlWhole, MatchCase:=False).Offset(, 1).Value
End If
Next c
Application.EnableEvents = True
End If
End Sub
Everything until now works great now with all that information i would like to add the when i choose a name on the drop down menu on page "pag1" also on that same page prints the following:
in cell "A6", "E-mail:" and the email for the person selected according the table at the begining of this post
In cell "A7", "Asesor de Ventas:" and the name of the person selected on the drop down list
As an example on the drp down list if i choose Kevin Oliveros it will be like this on A6 and A7
I have a Page called "Vendedores" with the following table: ( On this table i have all the information i need)
On a second page Called "pag1" i have a drop down list with the information on the table before
The thing with this table is that on the Drop Down menu i can see the names, but if i choose a name instead of show the name on that cell "N2" it shows the number
Example if i choose Kevin Oliveros instead of show the name it will show the number 12 because is the number on the table for that name.
For this to work i use the follow code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Changed As Range, c As Range
Set Changed = Intersect(Target, Range("N2")) '<- Edit range as required
If Not Changed Is Nothing Then
Application.EnableEvents = False
For Each c In Changed
If Len(c.Value) > 0 Then
c.Value = Sheets("Vendedores").Range("A2:A500").Find(What:=c.Value, LookAt:=xlWhole, MatchCase:=False).Offset(, 1).Value
End If
Next c
Application.EnableEvents = True
End If
End Sub
Everything until now works great now with all that information i would like to add the when i choose a name on the drop down menu on page "pag1" also on that same page prints the following:
in cell "A6", "E-mail:" and the email for the person selected according the table at the begining of this post
In cell "A7", "Asesor de Ventas:" and the name of the person selected on the drop down list
As an example on the drp down list if i choose Kevin Oliveros it will be like this on A6 and A7