Como ejecutar un procedimiento vba con el resultado de una función Buscarv
Tengo un procedimiento vba que oculta o muestra unas imágenes de acuerdo al valor de una celda, ya lo he probado y funciona perfectamente, mi problema inicia al querer que el procedimiento actúe de acuerdo al resultado de la función Buscarv.
Aquí dejó parte del procedimiento que realice, agradezco su ayuda y sus valiosos comentarios .
P.d., no soy un experto en programación vba hago lo que puedo a mi entender, muchas gracias
Private Sub Worksheet_Change(ByVal Target As Range)
Valor = Range("AG2").Value
If Valor > 7 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 0 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 1 Then
ActiveSheet.Shapes("Imagen 1").Visible = True
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 2 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = True
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 3 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = True
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 4 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = True
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 5 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = True
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = False
ElseIf Valor = 6 Then
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = True
ActiveSheet.Shapes("Imagen 7").Visible = False
Else
ActiveSheet.Shapes("Imagen 1").Visible = False
ActiveSheet.Shapes("Imagen 2").Visible = False
ActiveSheet.Shapes("Imagen 3").Visible = False
ActiveSheet.Shapes("Imagen 4").Visible = False
ActiveSheet.Shapes("Imagen 5").Visible = False
ActiveSheet.Shapes("Imagen 6").Visible = False
ActiveSheet.Shapes("Imagen 7").Visible = True
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Direccion = ActiveCell.Address
Cambiar = True
End Sub