Visual Basic para Aplicaciones - Buscador con vba de libros distintos

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil

Buscador con vba de libros distintos

Publicado por Karlos (2 intervenciones) el 31/10/2017 14:36:04
Saludos
Desearía saber si puedo crear un buscador con vba de un libro a otro
Pues en uno tengo la base de datos en el otro tengo los procesos
Y deseo buscar con vba que me busque y me traiga cierta información de la base de datos a mi otro libro

Tengo un código pero es de hoja a otra dentro del.mismo libro desearía saber dónde.edito o cambio o si es otro código gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Buscador con vba de libros distintos

Publicado por JuanC (565 intervenciones) el 31/10/2017 15:20:45
y que tal si publicas el código o mejor los libros en cuestión?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

Buscador con vba de libros distintos

Publicado por Carlos Eduardo (2 intervenciones) el 31/10/2017 23:30:18
Hola juan gracias si lo siento soy nuevo en todo esto

pues ya los subi son dos archivos
desseo traer un buscador inteligente con vba
lo puedo hacer dentro del mismo libro pero no de libros diferentes

este codigo utilizop dentro del mismo libro
nose donde debo redirecionar antes de la hoja el libro o como hacerlo o si es otro codigo espero me ayudes


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Private Sub PRONOMBRE_Change()
Application.ScreenUpdating = False
Sheets("Prod Inv").Select
Range("C7").Select
LISTA.Clear
While ActiveCell.Value <> ""
M = InStr(1, UCase(ActiveCell.Value), UCase(PRONOMBRE.Text))
If M > 0 Then
LISTA.ColumnCount = 8
LISTA.AddItem
ActiveCell.Offset(0, -1).Select
LISTA.List(LISTA.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 3) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 6) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 7) = ActiveCell.Value
 
 
ActiveCell.Offset(0, -6).Select
End If
ActiveCell.Offset(1, 0).Select
 
Wend
 
Sheets("Movimientos").Select
Range("A1").Select
 
Application.ScreenUpdating = True
End Sub
 
Private Sub UserForm_Activate()
Application.ScreenUpdating = False
 
Sheets("Prod Inv").Select
Range("B7").Select
 
While ActiveCell.Value <> ""
ActiveCell.Offset(0, 50).Select
 
If ActiveCell.Value = 0 Then
ActiveCell.Offset(0, -50).Select
LISTA.ColumnCount = 8
LISTA.AddItem
LISTA.List(LISTA.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 3) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 6) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LISTA.List(LISTA.ListCount - 1, 7) = ActiveCell.Value
 
 
ActiveCell.Offset(1, -7).Select
Else
ActiveCell.Offset(1, -50).Select
End If
 
Wend
 
Sheets("Movimientos").Select
Range("A1").Select
Application.ScreenUpdating = True
End Sub
 
Private Sub LISTA_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
 
On Error GoTo ERR:
L = LISTA.List(LISTA.ListIndex, 0)
Sheets("Prod Inv").Select
Range("B7").Select
 
While ActiveCell.Value <> "" And ActiveCell.Value <> L And ActiveCell.Value <> Val(L)
ActiveCell.Offset(1, 0).Select
Wend
 
If ActiveCell.Value = "" Then
Unload Me
FORMULARIO.Show
 
 
Else
mensaje = LISTA.List(LISTA.ListIndex, 7)
    If mensaje > 0 Then
 
    COD1 = ActiveCell.Value
    ActiveCell.Offset(0, 0).Select
    NOMB1 = ActiveCell.Value
 
 
 
    Sheets("Movimientos").Select
    Range("C8").Select
    ActiveCell.Value = NOMB1
    Unload Me
 
    Else
 
    Dim movi As String
    Sheets("Movimientos").Select
    movi = Range("C7").Value
        If movi <> "Ventas" Then
        Sheets("Prod Inv").Select
         COD1 = ActiveCell.Value
         ActiveCell.Offset(0, 0).Select
         NOMB1 = ActiveCell.Value
 
         Sheets("Movimientos").Select
         Range("C8").Select
         ActiveCell.Value = NOMB1
         Unload Me
 
        Else
          MsgBox "No puedes seleccionar un producto con stock : " & mensaje
 
        End If
 
    End If
 
End If
 
ERR:
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar