Visual Basic - trabajar con varios libros en varios pcs

Life is soft - evento anual de software empresarial
 
Vista:

trabajar con varios libros en varios pcs

Publicado por alvaro (1 intervención) el 16/07/2010 02:06:22
hola a todos, soy nuevo en este foro y la verdad me vi en un problema que ni idea... de antemano les doy las gracias por la ayuda que me puedan brindar...
lo que pasa es que estoy haciendo un trabajo que requiere buscar un rango en un libro X y copiarlo en un libro Y a traves de un boton, pero tengo que hacer que se pueda trabajar en cualquier computador por lo que me imagino que no puedo usar rutas como C:\Usuario... ya que esa ruta cambiara en otro pc, pero no me deja llamar al otro libro de ninguna otra forma... eh aqui el codigo que llevo
Sub Botón5_Haga_clic_en()
Dim var As Integer
Dim libro As String
Dim hoja As String
For x = 2 To 1892
If Sheets("escenarios").Cells(4, 3).Value = Sheets("fuente").Cells(x, 4).Value Then
var = Sheets("escenarios").Cells(4, 3).Value
If Sheets("escenarios").Cells(6, 3).Value = Sheets("fuente").Cells(x, 6).Value Then
If Sheets("escenarios").Cells(5, 3).Value = Sheets("fuente").Cells(x, 5).Value Then
If Sheets("escenarios").Cells(3, 3).Value = Sheets("fuente").Cells(x, 3).Value Then
If Sheets("escenarios").Cells(2, 3).Value = Sheets("fuente").Cells(x, 2).Value Then
Sheets("escenarios").Cells(2, 1).Value = Sheets("fuente").Cells(x, 1).Value
libro = "VARS" & var & ".xls"
If var = 40 Then
hoja = "Hoja" & x - 1
Else
If var = 50 Then
hoja = "Hoja" & x - 379
Else
If var = 60 Then
hoja = "Hoja" & x - 758
Else
If var = 70 Then
hoja = "Hoja" & x - 1136
Else
If var = 80 Then
hoja = "Hoja" & x - 1514
End If
End If
End If
End If
End If
Sheets("escenarios").Cells(3, 1).Value = hoja
Sheets("escenarios").Cells(4, 1).Value = libro
Application.Goto Workbooks(libro).Sheets(hoja).Range("E4:F12").Select
Selection.Copy
Range("a8:h15").PasteSpecial
End If
End If
End If
End If
End If
Next
End Sub
espero que me puedan ayudar lo mas pronto posible, asi super urgente :)
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