Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Call MENSAJES
End Sub
Sub MENSAJES()
Range("B5").Value = "MATERIALES"
Range("B6").Value = "EQUIPOS"
Range("B7").Value = "MANO DE OBRA"
Range("B8").Value = "GASTOS ADMINISTRATIVOS DE OBRA"
Range("B9").Value = "UTILIDADES"
Call BOTON_GLOBAL
Call BOTON_ESPECIFICO
End Sub
Sub NOMBRE_PARTIDAS()
Dim X As Integer
Dim Y As Integer
Dim T As Integer ' HUMERO DE VECES QUE SE REPITE LA MACROS
Dim TJ As Integer ' VALOR UNICIAL DEL CICLO
Dim TJR As Integer 'CONDICION DE EJECUCON
Dim N_HOJA As String
Y = 1
X = 31
T = 23100 ' limite 150 pertidas
TJ = 1
Sheets("Hola").Select
For TJ = 1 To T
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
TJR = Cells(1, 1).Value
If TJR = 1 Then
ActiveSheet.Next.Select
Else
N_HOJA = ActiveSheet.Name
Cells(1, 1).Value = 1
Sheets("Hola").Select
Cells(X, Y).Value = N_HOJA
X = X + 1
ActiveSheet.Next.Select
End If
Else
TJ = 23100
End If
Next
Sheets(Sheets.Count).Select
N_HOJA = ActiveSheet.Name
Sheets("Hola").Select
Cells(X, Y).Value = N_HOJA
T = 23100
TJ = 1
Sheets("Hola").Select
For TJ = 1 To T
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
Cells(1, 1).Value = ""
ActiveSheet.Next.Select
Else
TJ = 23100
End If
Next
Sheets("Hola").Select
End Sub
Sub CONSOLIDADO()
Dim J As Integer
Dim J1 As Integer
Dim X As Integer
Dim Y As Integer
Dim XW As Integer
Dim YW As Integer
Dim CONSOLIDADOXY As String
Dim X1 As Integer
Dim Y1 As Integer
Dim CHEQUEO As Integer
Dim MATERIALES2 As Double
Dim EQUIPOS2 As Double
Dim COSTO_EQUIPO2 As Double
Dim TOTAL_JORNAL2 As Double
Dim TOTAL_BONO2 As Double
Dim TOTAL_PRESTACIONES2 As Double
Dim GASTOS_ADMINISTRATIVOS2 As Double
Dim UTILIDADES2 As Double
Dim UNITARIO2 As Double
Dim RENDIMENTO2 As Double
Dim CANTIDAD2 As Double
Sheets("Hola").Select
palabraB10 = Range("C24").Value
palabraB20 = Range("C25").Value
palabraB30 = Range("C26").Value
palabraB40 = Range("C27").Value
Call NOMBRE_PARTIDAS
'creando hoja
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Select
Sheets(Sheets.Count).Name = "CONSOLIDADO"
Sheets("Hola").Select
MATERIALES2 = 0
EQUIPOS2 = 0
COSTO_EQUIPO2 = 0
TOTAL_JORNAL2 = 0
TOTAL_BONO2 = 0
TOTAL_PRESTACIONES2 = 0
GASTOS_ADMINISTRATIVOS2 = 0
UTILIDADES2 = 0
UNITARIO2 = 0
RENDIMENTO2 = 0
CANTIDAD2 = 0
CHEQUEO = 0
' VRIFICAL SI LAS HOJA DE MATERIALES EXISTE
X = 11
Y = 11
X1 = 10
Y1 = 2
XW = 31
YW = 1
CONSOLIDADOXY = ""
Cells(XW, YW).Select
Do While ActiveCell <> Empty
CONSOLIDADOXY = Cells(XW, YW).Value
If CONSOLIDADOXY = "Materiales" Then
Sheets("Materiales").Select
Cells(1, 1).Value = 1
End If
XW = XW + 1
Cells(XW, YW).Select
Loop
J = 1
J1 = 23100
Sheets("Partida 1").Select
For J = 1 To J1
'DEFINIENDO VARIABLES
D20 = 1 'VERIFICADOR DE PROGRAMA
X20 = 11 'NUMERO DE CALDA HORIZOLTAL (INICIO DE CELDA)
Y20 = 6 ' NUMERO DE CELDA VERTICAL (INICIO DE CELDA)
C20 = 1 ' VALOR INICIAL DEL CICLO (SIMPRE 1)
FIN20 = 70 ' VALOR FINAL DEL CICLO( NUMERO DETERMINADOPOR EL RANGO QUE SE DESEE
BUSCAR)
For C20 = 1 To FIN20
'MANO DE
OBRA'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''
Dim palabra30 As String
Dim C30 As Integer
Dim FIN30 As Integer
Dim X30 As Integer
Dim Y30 As Integer
Dim D30 As Integer
Dim TOTAL_JORNAL30 As Double
Dim TOTAL_BONO30 As Double
Dim TOTAL_PRESTACIONES30 As Double
'DEFINIENDO VARIABLES
D30 = 1 'VERIFICADOR DE PROGRAMA
X30 = 11 'NUMERO DE CALDA HORIZOLTAL (INICIO DE CELDA)
Y30 = 4 ' NUMERO DE CELDA VERTICAL (INICIO DE CELDA)
C30 = 1 ' VALOR INICIAL DEL CICLO (SIMPRE 1)
FIN30 = 70 ' VALOR FINAL DEL CICLO( NUMERO DETERMINADOPOR EL RANGO QUE SE DESEE
BUSCAR)
'ADMINISTRATIVO
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''
Dim palabra40 As String
Dim C40 As Integer
Dim FIN40 As Integer
Dim X40 As Integer
Dim Y40 As Integer
Dim D40 As Integer
Dim GASTOS_ADMINISTRATIVOS40 As Double
Dim UTILIDADES40 As Double
Dim UNITARIO40 As Double
Dim RENDIMENTO40 As Double
Dim CANTIDAD40 As Double
'DEFINIENDO VARIABLES
D40 = 1 'VERIFICADOR DE PROGRAMA
X40 = 11 'NUMERO DE CALDA HORIZOLTAL (INICIO DE CELDA)
Y40 = 4 ' NUMERO DE CELDA VERTICAL (INICIO DE CELDA)
C40 = 1 ' VALOR INICIAL DEL CICLO (SIMPRE 1)
FIN40 = 70 ' VALOR FINAL DEL CICLO( NUMERO DETERMINADOPOR EL RANGO QUE SE DESEE
BUSCAR)
CANTIDAD40 = 0
'CONTUNUAR MACROS
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''
Cells(1, 1).Value = 1
Sheets("CONSOLIDADO").Select
Range("B9:L9").Interior.Color = RGB(191, 191, 191)
'MENBRETE
Range("B9").Select
ActiveCell.FormulaR1C1 = "MATERIALES"
Range("C9").Select
ActiveCell.FormulaR1C1 = "EQUIPO"
Range("D9").Select
ActiveCell.FormulaR1C1 = "EQUIP/REND."
Range("E9").Select
ActiveCell.FormulaR1C1 = "JORNAL"
Range("F9").Select
ActiveCell.FormulaR1C1 = "BONO"
Range("G9").Select
ActiveCell.FormulaR1C1 = "F.C.A.S."
Range("H9").Select
ActiveCell.FormulaR1C1 = "GAST. ADM"
Range("I9").Select
ActiveCell.FormulaR1C1 = "UTILIDADES"
Range("J9").Select
ActiveCell.FormulaR1C1 = "APU"
Range("K9").Select
ActiveCell.FormulaR1C1 = "RENDIMIENTO"
Range("L9").Select
ActiveCell.FormulaR1C1 = "CANTIDAD"
Y1 = 2
Cells(X1, Y1).Value = MATERIALES2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 3
Cells(X1, Y1).Value = EQUIPOS2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 4
Cells(X1, Y1).Value = COSTO_EQUIPO2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 5
Cells(X1, Y1).Value = TOTAL_JORNAL2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 6
Cells(X1, Y1).Value = TOTAL_BONO2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 7
Cells(X1, Y1).Value = TOTAL_PRESTACIONES2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 8
Cells(X1, Y1).Value = GASTOS_ADMINISTRATIVOS2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 9
Cells(X1, Y1).Value = UTILIDADES2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 10
Cells(X1, Y1).Value = UNITARIO2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 11
Cells(X1, Y1).Value = RENDIMENTO2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 12
Cells(X1, Y1).Value = CANTIDAD2
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
'CONSOLIDADO TOTAL DE OBRA
'MATERIALES
Y1 = 14
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-2]*RC[-12],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
'EQUIOS
Y1 = 15
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-3]*RC[-11],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 16
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-4]*RC[-11]/RC[-5],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 17
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-5]*RC[-11]/RC[-6],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 18
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-6]*RC[-11]/RC[-7],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 19
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND((RC[-3]+RC[-2]+RC[-1]),2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 20
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-8]*RC[-12],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
Y1 = 21
Cells(X1, Y1).Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-9]*RC[-12],2)"
Cells(X1, Y1).BorderAround LineStyle:=xlContinuous, Weight:=xlThin, Color:=RGB(0,
0, 0)
X1 = X1 + 1
Sheets("Partida 1").Select
End If
Else
J = 23100 'Exit For
End If
Next
'borrando marcas
J = 1
J1 = 340 'NUMERO DEVEES QUE SE REPITA LA MACROS
Sheets("Partida 1").Select
For J = 1 To J1
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
Cells(1, 1).Value = ""
Columns("K:K").Select
Selection.Delete Shift:=xlToLeft
ActiveSheet.Next.Select
End If
Next
End Sub
Sub BOTON_GLOBAL()
Sub BOTON_ESPECIFICO()
'
' BOTON_ESPECIFICO Macro
'
'
ActiveSheet.Buttons.Add(300, 262, 175.5, 24.75).Select
Selection.OnAction = "CONSOLIDADO"
ActiveSheet.Shapes("Button 2").Select
Selection.Characters.Text = "REGISTRO ESPECIFICO"
Range("A18").Select
End Sub
Sub CONSOLIDADO_ESPESIFICO()
Dim X As Integer
Dim Y As Integer
Dim INICIO As Integer
Dim FINAL As Integer
Dim X2 As Integer
Dim Y2 As Integer
Dim C As Integer
Dim C2 As Integer ' VALOR DE REPETICION DEL CICLO
Dim T As Integer
Dim T2 As Integer ' VALOR DE REPETICION DEL CICLO
Dim PALABRA1 As String
Dim PALABRA2 As String
Sheets("Hola").Select
Materiales = Range("G24").Value
Equipos = Range("G25").Value
Mano_de_obra = Range("G26").Value
Administrativo = Range("G27").Value
X2 = 11
INICIO = 1
FINAL = 20
C = 1
C2 = 60
T = 1
T2 = 8
PALABRA1 = ""
PALABRA2 = ""
Y = 2
X = 11
X2 = 11
Y2 = 10
Call FORMULAX
' buscando
materiales'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''
For C = 1 To C2
PALABRA1 = Cells(X, Y).Value
If PALABRA1 = Materiales Then
Y2 = 10
Cells(X2, Y2).Value = Materiales
X2 = X2 + 1
X = X + 2
Cells(X, Y).Select
Do While ActiveCell <> Empty
Y = 1
Y2 = 10
For T = 1 To T2
Cells(X, Y).Select
Selection.Copy
Cells(X2, Y2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Y = Y + 1
Y2 = Y2 + 1
Next
Y = 1
X = X + 1
X2 = X2 + 1
Cells(X, Y).Select
Loop
Else
X = X + 1
End If
Next
X = 11
C = 1
C2 = 60
T = 1
T2 = 8
Y = 2
' buscando
equipos''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''
For C = 1 To C2
PALABRA1 = Cells(X, Y).Value
X = 11
C = 1
C2 = 60
T = 1
T2 = 8
Y = 2
' buscando mano de
obra'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''
For C = 1 To C2
PALABRA1 = Cells(X, Y).Value
X = 11
C = 1
C2 = 60
T = 1
T2 = 8
Y = 4
' buscando mano de
obra'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''
For C = 1 To C2
PALABRA1 = Cells(X, Y).Value
Cells(X, 4).Select
Selection.Copy
Cells(X2, 11).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 7).Select
Selection.Copy
Cells(X2, 17).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'GASTOS ADMINISTRATIVOS
X2 = X2 + 1
X = X + 5
Cells(X, 3).Select
Selection.Copy
Cells(X2, 10).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 4).Select
Selection.Copy
Cells(X2, 11).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 8).Select
Selection.Copy
Cells(X2, 17).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'UTILIDADES
X2 = X2 + 1
X = X + 2
Cells(X, 5).Select
Selection.Copy
Cells(X2, 10).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 6).Select
Selection.Copy
Cells(X2, 11).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 8).Select
Selection.Copy
Cells(X2, 17).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells(X, 8).Select
Selection.Copy
Cells(X2, 17).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
X = X + 1
End If
Next
'camio de
hoja'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
Y = 2
X = 11
X2 = 11
Y2 = 10
ActiveSheet.Next.Select
Else
Exit For
End If
Next
End Sub
Sub borrar()
Dim Incioz As Integer
Dim Finalz As Integer
Sheets("Partida 1").Select
Incioz = 1
Finalz = 13
Sub FORMULAX()
Range("J8").Select
ActiveCell.FormulaR1C1 = "=R[-3]C[-5]&"" ""&R[-3]C[-4]"
Range("J9").Select
ActiveCell.FormulaR1C1 = "=R[-3]C[-7]"
Range("J10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-8]"
Range("K10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-8]"
Range("L10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-7]"
Range("M10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-7]"
Range("N10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-7]"
Range("O10").Select
ActiveCell.FormulaR1C1 = "=R[-1]C[-7]"
Range("P10").Select
ActiveCell.FormulaR1C1 = "=R[-2]C[-9]"
Range("Q10").Select
ActiveCell.FormulaR1C1 = "=R[-2]C[-9]"
Range("Q11").Select
End Sub
Sub CONSOLIDO_ESPECIFO_HOJA()
Dim X As Integer
Dim Y As Integer
Dim X2 As Integer
Dim Y2 As Integer
Dim C1 As Integer
Dim C2 As Integer
Dim XW As Integer
Dim YW As Integer
Dim CONSOLIDADOXY As String
Dim TESTIGO As Integer
X2 = 7
Y2 = 13
X = 3
Y = 2
ITEN = 1
'INCIO DE PROGRAMA
Call CONSOLIDADO_ESPESIFICO
Sheets("Hola").Select
Mat = Range("G24").Value
Equi = Range("G25").Value
Man_Obra = Range("G26").Value
Adm = Range("G27").Value
'Creando hoja
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Select
Sheets(Sheets.Count).Name = "CONSOLIDADO"
Sheets("Hola").Select
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
ActiveSheet.Next.Select
End If
Sheets("Partida 1").Select
'COMIENSO DE COPIADO
For C1 = 1 To C2
TESTIGO = Cells(1, 1).Value
If TESTIGO <> 1 Then
Cells(1, 1).Value = 1
Range("J8:Q60").Select
Selection.Copy
Sheets("CONSOLIDADO").Select
Range("M3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
N�P = Range("M3").Value
DESCRIPCION = Range("M4").Value
CODIGO = Range("N5").Value
UNIDAD = Range("P5").Value
CANTIDAD = Range("R5").Value
RENDIMIENTO = Range("T5").Value
'mteriales'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''
Cells(X, Y).Value = "Materiales"
X = X + 1
Cells(X, Y).Value = "Iten"
Y = 3
Cells(X, Y).Value = "C�digo"
Y = 4
Cells(X, Y).Value = "Descripci�n"
Y = 5
Cells(X, Y).Value = "Unidad"
Y = 6
Cells(X, Y).Value = "Cantidad"
Y = 7
Cells(X, Y).Value = "Desperdicio"
Y = 8
Cells(X, Y).Value = "Precio"
Y = 9
Cells(X, Y).Value = "Total"
Y = 2
X = X + 1
Cells(X2, Y2).Select
Do While ActiveCell <> Empty
CODIGO_MAERIALES = Cells(X2, Y2).Value
Y2 = 14
ITEN = Cells(X2, Y2).Value
Y2 = 15
DESCRIP_MATERIALES = Cells(X2, Y2).Value
Y2 = 16
UNIDAD_MATERILES = Cells(X2, Y2).Value
Y2 = 17
CANTIDAD_MATERIALES = Cells(X2, Y2).Value
Y2 = 18
DESPERDICIO = Cells(X2, Y2).Value
Y2 = 19
PRECIO_MATERIALES = Cells(X2, Y2).Value
'colocando materiles
Y = 2
Cells(X, Y).Value = ITEN
Y = 3
Cells(X, Y).Value = CODIGO_MAERIALES
Y = 4
Cells(X, Y).Value = DESCRIP_MATERIALES
Y = 5
Cells(X, Y).Value = UNIDAD_MATERILES
Y = 6
Cells(X, Y).Value = CANTIDAD_MATERIALES
Y = 7
Cells(X, Y).Value = DESPERDICIO
Y = 8
Cells(X, Y).Value = PRECIO_MATERIALES
ITEN = ITEN + 1
X = X + 1
X2 = X2 + 1
Y2 = 13
Cells(X2, Y2).Select
Loop
ITEN = 1
Else
If ActiveSheet.Name <> Sheets(Sheets.Count).Name Then
ActiveSheet.Next.Select
X2 = 7
Y2 = 13
End If
End If
Next
End Sub