Professional Documents
Culture Documents
Sub AbrirRuta()
'Ruta de Vector Acciones (Se puede eliminar en caso de cambios de Ruta o error) ChDrive "Z" ChDir "Z:\Riesgos de Mercado\3Inversiones\Operaciones de Reporte\Vector Acciones"
'Abrir Ventana de Dilogo para Seleccin del Archivo ruta = Application.GetOpenFilename("Archivos Excel (*.xls; *.xlsx), *.xls; *.xlsx", 1, "Seleccionar Archivo", , False)
If ruta = False Then Exit Sub Else 'Seleccionar los Archivo y Almcanenar los Nombres de Archivos en Celdas Range("E8", "G8").Value = ""
rutaArchivo = ruta nombreArchivo = Mid$(ruta, InStrRev(ruta, "\") + 1) Range("E8").Value = nombreArchivo 'Almacenar Ruta de Archivos en la Celda Respectiva Range("F8").Value = Mid$(ruta, 1, InStrRev(ruta, "\")) Range("I15").Select End If
End Sub
Sub ActualizarTablas()
Sheets("Vector").Select For i = 3 To [A1].End(xlToRight).Column If fecha = Cells(1, i) Then MsgBox ("Da indicado ya se encuentra en la base") 'Activa la Actualizacin de Pantalla Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic Exit Sub End If Next i
'Obtener Valores a Buscar Sheets("Vector").Select nroValores = [A1].End(xlDown).Row - 1 For i = 1 To nroValores ValorAccion(i) = Cells(i + 1, 1).Value Next i
.RefreshAll .Sheets("Hoja1").Select
Dim val As Integer val = 0 For i = 2 To [A1].End(xlDown).Row If Cells(i, 1) = fecha Then val = 1 End If Next i
If val = 1 Then
For i = 1 To nroValores For j = 2 To filafin If ValorAccion(i) = Cells(j, 2).Value And fecha = Cells(j, 1) Then PrecioAccion(i) = Cells(j, 6).Value End If Next j Next i
Else
End If
End With
'Llenar datos colIng = [A1].End(xlToRight).Column + 1 Cells(1, colIng).Value = fecha For i = 1 To nroValores If PrecioAccion(i) = 0 Then Cells(i + 1, colIng).Value = Cells(i + 1, colIng - 1).Value Else Cells(i + 1, colIng).Value = PrecioAccion(i) End If Next i
'Dar formato de Celdas Columns(colIng - 1).Select Selection.Copy Columns(colIng).Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False Cells(1, 1).Select
Application.Calculation = xlCalculationAutomatic
End Sub
Sub ForzarDia()
'Copiar Valores Columns(colIng - 1).Select Selection.Copy Columns(colIng).Select ActiveSheet.Paste Application.CutCopyMode = False Cells(1, 1).Select
End Sub
Select Case X Case 1 NOMBREDIA = "Lunes" Case 2 NOMBREDIA = "Martes" Case 3 NOMBREDIA = "Mircoles" Case 4 NOMBREDIA = "Jueves" Case 5 NOMBREDIA = "Viernes" Case 6 NOMBREDIA = "Sbado" Case 7 NOMBREDIA = "Domingo" End Select End Function