Sunteți pe pagina 1din 372

ThisWorkbook - 1 Private Sub Workbook_BeforeClose(Cancel As Boolean) Call DeleteMenu End Sub Private Sub Workbook_Open() Call MakeMenu ponerPasswordEnHoja

Pantallazo.Show 'Mexcel.Show End Sub

CConceptos - 1 Option Explicit Private Sub ComboBox1_Change() Dim Li, i, j As Double Dim Celda1, Celda4 As Range Dim ipoint As Integer Dim Respuesta As Integer Hoja4.Activate If exitleavecellconcepto = False Then Exit Sub Li = Lastrowconcepto If Laststringconcepto = "" Then Exit Sub i = ComboBox1.ListIndex If i = 6 Then Exit Sub If (Li) < Regconcepto Then ipoint = 0 'FILTRAR EL CAMBIO If Tipo_concepto = 7 Then MsgBox "No se puede cambiar de tipo un concepto auxiliar" exitleavecellconcepto = False ComboBox1.ListIndex = 6 exitleavecellconcepto = True Exit Sub 'los auxiliares no se pueden cambiar End If If Tipo_concepto = 6 Then MsgBox "No se puede cambiar de tipo un concepto capitulos" exitleavecellconcepto = False ComboBox1.ListIndex = 6 exitleavecellconcepto = True Exit Sub 'los capitulos no se pueden cambiar End If 'SEGUNDO LOCALIZARLO EN LA BASE DATOS DE LOS CONCEPTOS For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Laststringconcepto) Then Exit For End If Next j If j > IConceptos Then Exit Sub 'no lo ha encontrado en la base de datos 'ComboBox1.AddItem "a mano de obra" 'Tipo_concepto = 1 'ComboBox1.AddItem "a maquinaria" 'Tipo_concepto = 2 'ComboBox1.AddItem "a materiales" 'Tipo_concepto = 3 'ComboBox1.AddItem "a subcontrata" 'Tipo_concepto = 4 'ComboBox1.AddItem "a partida" 'Tipo_concepto = 5 'ComboBox1.AddItem "a capitulo" 'Tipo_concepto = 6 'ComboBox1.AddItem " " 'vacio If i = 0 Then Hoja4.Cells(j + ipuntero + 1, 4) = "mo" '"mat" ElseIf i = 1 Then Hoja4.Cells(j + ElseIf i = 2 Then Hoja4.Cells(j + ElseIf i = 3 Then Hoja4.Cells(j + ElseIf i = 4 Then Hoja4.Cells(j + ElseIf i = 5 Then Hoja4.Cells(j + End If End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub CommandButtonCap_Click() Tipo_concepto = 6 ipuntero + 1, 4) = "maq" '"mo" ipuntero + 1, 4) = "mat" '"maq" ipuntero + 1, 4) = "sub" ipuntero + 1, 4) = "P" ipuntero + 1, 4) = "C"

CConceptos - 2 CConceptos.Caption = " Editor de Conceptos;" & " Capitulos" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton2_Click() Tipo_concepto = 7 CConceptos.Caption = " Editor de Conceptos;" & " Medios Auxiliares" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton3_Click() Tipo_concepto = 2 CConceptos.Caption = " Editor de Conceptos;" & " Maquinaria" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton4_Click() Tipo_concepto = 1 CConceptos.Caption = " Editor de Conceptos;" & " Mano de Obra" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton5_Click() salvaultimodatoconcepto Tipo_concepto = 3 CConceptos.Caption = " Editor de Conceptos;" & " Materiales" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton6_Click() Tipo_concepto = 4 CConceptos.Caption = " Editor de Conceptos;" & " Subcontratas" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Public Sub ConceptoButton7_Click() Tipo_concepto = 5 CConceptos.Caption = " Editor de Conceptos;" & " Partidas alzadas, otros conceptos" limpiarcodigo volcarconcepto ListBox1.ListIndex = 0 End Sub Private Sub Eliminar_Click() Dim Li, i, j As Double Dim Celda1, Celda4 As Range Dim ipoint As Integer Dim Respuesta As Integer Hoja4.Activate Li = Lastrowconcepto If Laststringconcepto = "" Then Exit Sub If Li < Regconcepto Then

CConceptos - 3 'PRIMERO VER SI ESTA DENTRO DEL PROYECTO For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then

D_Proy = Hoja7.Cells(97 + i, 4) Ipuntos = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos If Strings.Trim(Hoja4.Cells(j + D_Proy, 2)) = Strings.Trim(Laststringconcepto) Then 'EL CODIGO ESTA DENTRO DE ALGUN EXPEDINTE Y SE MARCHA MsgBox "No se puede borrar un concepto que esta en el presupuesto!!!" Exit Sub End If Next j End If Next i 'SEGUNDO EN LA DESCOMPOSICION DE PARTIDAS For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Laststringconcepto) Then 'EL CODIGO ESTA DENTRO DE UN DESCOMPUESTO DE PARTIDA MsgBox "No se puede borrar un concepto que esta de auxiliar de partida!!!" Exit Sub End If j = j + 1 Loop Next

Respuesta = MsgBox("Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Activate For i = (ipuntero + 2) To (IConceptos + ipuntero + 2) If Strings.Trim(Hoja4.Cells(i, 1)) = Strings.Trim(Laststringconcepto) Then Exit For End If Next i Set Celda1 = Hoja4.Cells(i, 1) Set Celda4 = Hoja4.Cells(i, 250) Hoja4.Range(Celda1, Celda4).Select Selection.Delete Shift:=xlUp ordenarconcepto End If End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub Insertar_Click() Dim i, j, Li As Integer Dim TempBase As Double Dim Respuesta As Integer If IsEmpty(Hoja7.Range("B26")) = True Then Exit Sub Li If If If = Lastrowconcepto Li = 1 Then Exit Sub Laststringconcepto = "" Then Exit Sub Li > Regconcepto Then Exit Sub

Hoja4.Activate

If tipoedicion = False Then If (InStr(1, Laststringconcepto, "%") <> 0) Then 'Filtroaux 'no se permiten medios auxiliares en partidas porque Respuesta = MsgBox(" No se permiten Medios auxiliares" & vbNewLine & "que esten fu

CConceptos - 4 era de la descomposicin de partidas.", vbYes, "ATENCIN") Else TempBase = Hoja7.Range("B26") j = 1 Do While j < 99 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = TempBase + j Then Exit For Next i If i > Ipuntos Then Exit Do j = j + 1 Loop If j = 99 Then Exit Sub Ipuntos = Ipuntos + 1 Hoja4.Cells(Ipuntos + D_Proy, 1) = TempBase + j Hoja4.Cells(Ipuntos + D_Proy, 2) = Laststringconcepto End If i = 0 Do While Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "" i = i + 1 Loop Hoja4.Cells(posicionconcepto, 100 + i * 4) = Strings.Trim(Laststringconcepto) Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1) = "" Hoja4.Cells(posicionconcepto, 100 + i * 4 + 2) = ""

Else

End If End Sub

Private Sub ListBox1_Click() Dim i As Integer i = ListBox1.ListIndex 'If exitleavecellconcepto = False Then Exit Sub 'Lj = Lastcolconcepto 'Li = Lastrowconcepto 'Lastcolconcepto = 1 Lastrowconcepto = i TextBox1.Text = ListBox1.List(i, 0) TextBox2.Text = ListBox1.List(i, 1) TextBox3.Text = ListBox1.List(i, 2) Laststringconcepto = TextBox1.Text TextBox4.Text = ListBox1.List(i, 3) End Sub

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Respuesta As Integer Dim Celda1, Celda4 As Range Dim ipoint As Integer Dim Laststringconcepto_temp As String Dim Scelda As String Dim Li As Integer If exitleavecellconcepto = False Then Exit Sub Hoja4.Activate Li = Lastrowconcepto Scelda = TextBox1.Text If Strings.Trim(Laststringconcepto) = Strings.Trim(Scelda) Then Exit Sub If Li > Regconcepto Then

CConceptos - 5 exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If

i = 1 If car_raros(Scelda) Or Strings.Trim(Scelda) = "%" Or Strings.Trim(Scelda) = "%%" Or Strings.Trim(S celda) = "%%%" Then exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True 'limpiarcodigo 'volcarconcepto Exit Sub End If ipoint = 0 If Strings.Trim(Scelda) = "" Then 'If (Lii - 1) < Regconcepto Then 'PRIMERO VER SI ESTA DENTRO DEL PROYECTO For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then

to) Then

D_Proy = Hoja7.Cells(97 + i, 4) Ipuntos = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos If Strings.Trim(Hoja4.Cells(j + D_Proy, 2)) = Strings.Trim(Laststringconcep 'EL CODIGO ESTA DENTRO DE ALGUN EXPEDINTE Y SE MARCHA MsgBox "No se puede borrar un concepto que esta en el presupuesto!!!" exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If Next j End If Next i 'SEGUNDO EN LA DESCOMPOSICION DE PARTIDAS

) Then

For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Laststringconcepto 'EL CODIGO ESTA DENTRO DE UN DESCOMPUESTO DE PARTIDA MsgBox "No se puede borrar un concepto que esta de auxiliar de partida!!!" exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If j = j + 1

Next

Loop

Respuesta = MsgBox("Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Activate For i = (ipuntero + 2) To (IConceptos + ipuntero + 2) If Strings.Trim(Hoja4.Cells(i, 1)) = Strings.Trim(Laststringconcepto) Then Exit For End If Next i Set Celda1 = Hoja4.Cells(i, 1) Set Celda4 = Hoja4.Cells(i, 250) Hoja4.Range(Celda1, Celda4).Select Selection.Delete Shift:=xlUp

CConceptos - 6 ordenarconcepto 'inicializaconcepto limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End If 'End If If Strings.Trim(Scelda) = "Redondeo" Then exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If If Strings.Trim(Scelda) = "&&" Then exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If If Li < Regconcepto Then Hoja4.Activate ' AQUI SE CAMBIA UN CODIGO POR OTRO 'PRIMERO QUE EL CODIGO DEL CAMBIO PERTENEZCA AL If (InStr(1, Scelda, "%") <> 0) Then 'Filtroaux If Tipo_concepto <> 7 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If ElseIf tipo_de_concepto(Scelda) = "C" Then If Tipo_concepto <> 6 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If ElseIf (InStr(1, Scelda, Filtromaq) <> 0) Then If Tipo_concepto <> 2 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If ElseIf (InStr(1, Scelda, Filtroman) <> 0) Then If Tipo_concepto <> 1 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If ElseIf (InStr(1, Scelda, Filtromat) <> 0) Then If Tipo_concepto <> 3 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If ElseIf (InStr(1, Scelda, Filtrosub) <> 0) Then If Tipo_concepto <> 4 Then MsgBox "El cdigo nuevo tiene que tener exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If

Else

TIPO DE CONCEPTO EDITADO EN ESE MOMENTO inscrito el filtro correcto!!!"

inscrito el filtro correcto!!!"

inscrito el filtro correcto!!!"

inscrito el filtro correcto!!!"

inscrito el filtro correcto!!!"

inscrito el filtro correcto!!!"

CConceptos - 7 Else Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "P" If Tipo_concepto <> 5 Then MsgBox "El cdigo nuevo tiene que tener inscrito el filtro correcto!!!" exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) exitleavecellconcepto = True Exit Sub End If End If '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% '"a materiales" 'Tipo_concepto = 3 '"a mano de obra" 'Tipo_concepto = 1 '"a maquinaria" 'Tipo_concepto = 2 '"a subcontrata" 'Tipo_concepto = 4 '"a partida" 'Tipo_concepto = 5 '"a capitulo" 'Tipo_concepto = 6 '"a auxiliar" 'Tipo_concepto = 7 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Scelda) Then MsgBox "Este concepto existe en la base de conceptos!!!" exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) ListBox1.ListIndex = Li exitleavecellconcepto = True Exit Sub 'Esta repetido End If Next j 'SEGUNDO IR CAMBIANDO EN LAS ESTRUCTURAS DEL PRESUPUESTO For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then D_Proy = Hoja7.Cells(97 + i, 4) Ipuntos = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos If Strings.Trim(Hoja4.Cells(j + D_Proy, 2)) = Strings.Trim(Laststringconcepto) Hoja4.Cells(j + D_Proy, 2) = Strings.Trim(Scelda) End If Next j End If Next i 'TERCERO CAMBIAR EL CODIGO DE NOMBRE POR EL NUEVO

Then

en

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Laststringconcepto) Th Hoja4.Cells(j + ipuntero + 1, 1) = Strings.Trim(Scelda) Exit For 'Esta sustituido End If Next j 'CUARTO CAMBIAR EL CODIGO EN LOS DESCOMPUESTOS

en

For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Laststringconcepto) Th Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Scelda) End If j = j + 1

Else

Next

Loop

'SE INTRODUCE UN NUEVO CODIGO 'Li = Regconcepto

CConceptos - 8

nceptos"

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Scelda) Then MsgBox "Este concepto existe en la base de conceptos!!!" exitleavecellconcepto = False TextBox1.Text = ListBox1.List(Li, 0) ListBox1.ListIndex = Li exitleavecellconcepto = True Exit Sub 'Esta repetido End If Next j '***** Hoja4.Cells(ipuntero + 2 + IConceptos, 1) = Strings.Trim(Scelda) 'Scelda es el nuevo cdigo 'ComboBox1.AddItem "a materiales" 'Tipo_concepto = 3 'ComboBox1.AddItem "a mano de obra" 'Tipo_concepto = 1 'ComboBox1.AddItem "a maquinaria" 'Tipo_concepto = 2 'ComboBox1.AddItem "a subcontrata" 'Tipo_concepto = 4 'ComboBox1.AddItem "a partida" 'Tipo_concepto = 5 'ComboBox1.AddItem "a capitulo" 'Tipo_concepto = 6 If (InStr(1, Scelda, "%") <> 0) Then 'Filtroaux Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "%" If Tipo_concepto <> 7 Then Tipo_concepto = 7 CConceptos.Caption = " Editor de Conceptos;" & " Medios Auxiliares" Li = 0 End If ElseIf tipo_de_concepto(Scelda) = "C" Then 'tipo_de_concepto (Scelda) <> "C" Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "C" If Tipo_concepto <> 6 Then Tipo_concepto = 6 CConceptos.Caption = " Editor de Conceptos;" & " Capitulos y Subcapitulos" Li = 0 End If ElseIf (InStr(1, Scelda, Filtromaq) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "maq" If Tipo_concepto <> 2 Then Tipo_concepto = 2 CConceptos.Caption = " Editor de Conceptos;" & " Maquinaria" Li = 0 End If ElseIf (InStr(1, Scelda, Filtroman) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "mo" If Tipo_concepto <> 1 Then Tipo_concepto = 1 CConceptos.Caption = " Editor de Conceptos;" & " Mano de Obra" Li = 0 End If ElseIf (InStr(1, Scelda, Filtromat) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "mat" If Tipo_concepto <> 3 Then Tipo_concepto = 3 CConceptos.Caption = " Editor de Conceptos;" & " Materiales" Li = 0 End If ElseIf (InStr(1, Scelda, Filtrosub) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "sub" If Tipo_concepto <> 4 Then Tipo_concepto = 4 CConceptos.Caption = " Editor de Conceptos;" & " Subcontratas" Li = 0 End If Else Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "P" If Tipo_concepto <> 5 Then Tipo_concepto = 5 CConceptos.Caption = " Editor de Conceptos;" & " Partidas alzadas, otros co Li = 0 End If End If ordenarconcepto

End If

CConceptos - 9 End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'entrada de unidades Dim Li, i, j As Double Dim ipoint As Integer Dim Snuevocodigo As String If exitleavecellconcepto = False Then Exit Sub Hoja4.Activate Li = Lastrowconcepto 'If Li = 1 Then Exit Sub If Laststringconcepto = "" Then exitleavecellconcepto = False TextBox2.Text = ListBox1.List(Li, 2) exitleavecellconcepto = True Exit Sub End If Snuevocodigo = TextBox2.Text If Li < Regconcepto Then ipoint = 0 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Laststringconcepto) Then Hoja4.Cells(j + ipuntero + 1, 2) = Strings.Left(Snuevocodigo, 3) Exit For 'Esta sustituido End If Next j End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Li, i, j As Double Dim ipoint As Integer Dim Snuevocodigo As String If exitleavecellconcepto = False Then Exit Sub Hoja4.Activate Li = Lastrowconcepto If Laststringconcepto = "" Then exitleavecellconcepto = False TextBox3.Text = ListBox1.List(Li, 2) exitleavecellconcepto = True Exit Sub End If Snuevocodigo = TextBox3.Text If Li < Regconcepto Then ipoint = 0 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Laststringconcepto) Then Hoja4.Cells(j + ipuntero + 1, 3) = Strings.Left(Snuevocodigo, 50) Exit For 'Esta sustituido End If Next j

CConceptos - 10 End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Double Dim i As Double Dim j As Integer Dim Respuesta As Integer Dim Scelda As String Dim Li As Integer If exitleavecellconcepto = False Then Exit Sub Hoja4.Activate Li = Lastrowconcepto If Laststringconcepto = "" Then exitleavecellconcepto = False TextBox4.Text = ListBox1.List(Li, 3) exitleavecellconcepto = True Exit Sub End If Scelda = TextBox4.Text If Li >= Regconcepto Then exitleavecellconcepto = False TextBox4.Text = ListBox1.List(Li, 3) exitleavecellconcepto = True Exit Sub End If If IsNumeric(Scelda) = False Then exitleavecellconcepto = False TextBox4.Text = ListBox1.List(Li, 3) exitleavecellconcepto = True Exit Sub End If '"a '"a '"a '"a '"a '"a '"a materiales" 'Tipo_concepto = 3 mano de obra" 'Tipo_concepto = 1 maquinaria" 'Tipo_concepto = 2 subcontrata" 'Tipo_concepto = 4 partida" 'Tipo_concepto = 5 capitulo" 'Tipo_concepto = 6 auxiliar" 'Tipo_concepto = 7

If Tipo_concepto = 6 Or Tipo_concepto = 7 Then MsgBox "No se puede cambiar el precio de un auxiliar o capitulo!!!" exitleavecellconcepto = False TextBox4.Text = ListBox1.List(Li, 3) exitleavecellconcepto = True Exit Sub 'ABANDONAR SI SON CAPITULOS O AUXILIARES End If For i = (ipuntero + 2) To (IConceptos + ipuntero + 2) If Strings.Trim(Hoja4.Cells(i, 1)) = Strings.Trim(Laststringconcepto) Then Exit For End If Next i Dtemp = CDbl(Strings.Trim(Scelda)) If CDbl(Hoja4.Cells(i, 5)) = Dtemp Then 'SE HA INTRODUCIDO EL MISMO PRECIO exitleavecellconcepto = False TextBox4.Text = ListBox1.List(Li, 3) exitleavecellconcepto = True Exit Sub

End If For j = 100 To 232 If Hoja4.Cells(i, j) <> "" Then Exit For Next j If j < 232 Then Respuesta = MsgBox(" Est seguro de insertar precio sin descomponer?" & vbNewLine & " Per der la descomposicin del precio!!!", vbYesNo, "ATENCIN")

CConceptos - 11 If Respuesta = 6 Then Hoja4.Activate If Scelda = "" Then 'Hoja4.Cells(i + iPuntero + 1, 9) = "0" Hoja4.Cells(i, 5) = "0" Sumartodo Else Dtemp = CDbl(Strings.Trim(Scelda)) Dtemp = Round(Dtemp, format_prec) Hoja4.Cells(i, 5) = Dtemp Sumartodo End If For j = 100 To 255 Hoja4.Cells(i, j) = "" Next j End If Else Hoja4.Activate If Scelda = "" Then Hoja4.Cells(i, 5) = "0" Sumartodo Else Dtemp = CDbl(Strings.Trim(Scelda)) Dtemp = Round(Dtemp, format_prec) Hoja4.Cells(i, 5) = Dtemp Sumartodo End If

End If limpiarcodigo volcarconcepto ListBox1.ListIndex = Li End Sub Private Sub TexTo_Click() Dim Li As Integer Dim i As Double 'Dim temp Hoja4.Activate Li = Lastrowconcepto If Laststringconcepto = "" Then Exit Sub If Li >= Regconcepto Then Exit Sub filaconcepto = Li posicionconcepto = 0 For i = (ipuntero + 2) To (IConceptos + ipuntero + 2) If Strings.Trim(Hoja4.Cells(i, 1)) = Strings.Trim(Laststringconcepto) Then posicionconcepto = i End If Next i Cuadrotextoconcep.Show End Sub Public Sub UserForm_Activate() Dim j As Integer Dim i As Integer RemoverPasswordEnHoja exitleavecellconcepto = False ListBox1.ColumnCount = 4 ListBox1.ColumnWidths = "80;40;300;40" List_Head_concepto ipuntero = Hoja7.Range("B23")

CConceptos - 12 Regconcepto = 1 Hoja4.Activate Tipo_concepto = 5 ' el tipo de concepto partidas

CConceptos.Caption = " Editor de Partidas;" & " Conceptos generales, inc. partidas alzadas, otros c onceptos" GetStartconcepto ordenarconcepto ComboBox1.AddItem "a mano de obra" 'Tipo_concepto = 1 ComboBox1.AddItem "a maquinaria" 'Tipo_concepto = 2 ComboBox1.AddItem "a materiales" 'Tipo_concepto = 3 ComboBox1.AddItem "a subcontrata" 'Tipo_concepto = 4 ComboBox1.AddItem "a partida" 'Tipo_concepto = 5 ComboBox1.AddItem "a capitulo" 'Tipo_concepto = 6 ComboBox1.AddItem " " 'vacio '"a auxiliar" 'Tipo_concepto = 7 referenciar volcarconcepto ListBox1.ListIndex = 0 det_Existvalueconcepto ' exitleavecellconcepto = True End Sub Private Sub GetStartconcepto() Dim j As Integer 'Dim Tbolean As Boolean Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,##0" "#,##0.0" "#,##0.00" "#,##0.000" "#,##0.0000"

Existvalue = "" format_prec = Hoja7.Range("B16") Filtroaux = "%" Filtrocap = Hoja7.Range("B9") Filtrocap2 = Hoja7.Range("B10") Filtromaq Filtroman Filtromat Filtrosub = = = = Hoja7.Range("B13") Hoja7.Range("B11") Hoja7.Range("B12") Hoja7.Range("B14") 'maquinaria 'mano de obra 'materiales 'subcontratista

Existvalue = "" End Sub Private Sub nuevoconcepto() 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, 'Cuadroconcepto.Cells(1, End Sub Private Sub Salir_Click() 1) 2) 3) 4) 5) 6) 7) = = = = = = = "Cdigo" "Ud." "Resmen" "Precio" "" "" ""

CConceptos - 13

referenciar ' coge los expedientes y les pone una C y vinvula el codgo con la posicin que ocu pa en el cuadro de conceptos Unload Me End Sub

Comenzar - 1 Private Sub Aceptar_Click() Dim i As Integer Dim j As Integer Dim Respuesta As Integer Respuesta = MsgBox("Se perder toda la informacin" & vbNewLine & " vbYesNo, "ATENCIN") If Respuesta = 6 Then A_limpiar End If End Sub Private Sub Cancelar_Click() End End Sub Private Sub CommandButton1_Click() Unload Me Mexcel.Show End Sub Public Sub UserForm_Activate() End Sub Esta seguro?

",

Config - 1 Private Sub CheckBox1_Click() 'CALCULO AUTOMATICO O MANUAL 'checkbox1.value Hoja7.Activate If CheckBox1.Value = False Then Hoja7.Cells(29, 2) = False CheckBox1.Caption = "Calculo automtico desactivado"

Else

'CheckBox1.Value = True Hoja7.Cells(29, 2) = True CheckBox1.Caption = "Calculo automtico activado" End If End Sub Private Sub Label1_Click() End Sub Private Sub MultiPage1_Change() End Sub Private Sub Salir_Click() Unload Me End Sub

Public Sub UserForm_Activate() Dim j As Integer RemoverPasswordEnHoja Hoja7.Activate ipuntero = Hoja7.Range("B23") Proyecto.Text = Hoja7.Range("B1") comentarios.Text = Hoja7.Range("B2") COB.Text = Hoja7.Range("B7") CDEL.Text = Hoja7.Range("B8") GG.Text = Hoja7.Range("B31") BI.Text = Hoja7.Range("B32") B1.Text = Hoja7.Range("B33") B2.Text = Hoja7.Range("B34") CP.Caption = " " & Hoja7.Range("D34") FP.Text = Hoja7.Range("B38") EC.Text = Hoja7.Range("B39") DOB.Text = Hoja7.Range("B40") MPC.Text = Hoja7.Range("B15") IPC.Text = Hoja7.Range("B16") PEMC.Text = Hoja7.Range("B17") CAB.Text = Hoja7.Range("B18") OD.Text = Hoja7.Range("B19") IR.Text = Hoja7.Range("B20") 'IMPORTE DE LOS RECURSOS format_imprec = Hoja7.Range("B20") TextBox1.Text = Hoja7.Range("B21") 'MEDICIONES DESCOMPUESTAS LOG,ANCHO,ESPESOR format_meddes = Hoja7.Range("B21") FCAP.Text = Hoja7.Range("B9") FEC.Text = Hoja7.Range("B11") 'mano de obra FENC.Text = Hoja7.Range("B12") 'materiales FEP.Text = Hoja7.Range("B13") 'maquinaria FENP.Text = Hoja7.Range("B14") 'subcontratista Filtrocap = FCAP.Text Filtrocap2 = Hoja7.Range("B10") 'Filtropar 'Filtroaux

Config - 2 Filtromaq Filtroman Filtromat Filtrosub = = = = FEP.Text FEC.Text FENC.Text FENP.Text

FPRO.Text = Strings.format(Hoja7.Range("B37"), "mmmm-yy") FCO.Text = Strings.format(Hoja7.Range("B4"), "mmmm-yy") DOBRA.Text = Hoja7.Range("B5") 'presvia.Caption = Hoja7.Range("B94") j = 0 Do While IsEmpty(Hoja4.Cells(ipuntero + 1 + j + 1, 1)) = False j = j + 1 Loop IConceptos = j 'CALCULO AUTOMATICO O 'checkbox1.value If Hoja7.Cells(29, 2) CheckBox1.Value = CheckBox1.Caption Else CheckBox1.Value = CheckBox1.Caption End If MANUAL = False Then False = "Calculo automtico desactivado" True = "Calculo automtico activado"

End Sub Private Sub Proyecto_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(1, 2) = Strings.Trim(Proyecto.Text) End Sub Private Sub comentarios_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(2, 2) = Strings.Trim(comentarios.Text) End Sub Private Sub COB_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate If IsNumeric(COB.Text) Then Hoja7.Cells(7, 2) = CDbl(COB.Text) End If End Sub Private Sub CDEL_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate If IsNumeric(CDEL.Text) Then Hoja7.Cells(7, 2) = CDbl(CDEL.Text) End If End Sub Private Sub GG_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Double Hoja7.Activate If IsNumeric(GG.Text) Then Dtemp = CDbl(GG.Text) If (Dtemp <= 100 And Dtemp >= 0) Then Hoja7.Cells(31, 2) = CDbl(GG.Text) End If End If GG.Text = Hoja7.Range("B31") CP.Caption = " " & Hoja7.Range("D34") End Sub Private Sub BI_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Double Hoja7.Activate If IsNumeric(BI.Text) Then Dtemp = CDbl(BI.Text) If (Dtemp <= 100 And Dtemp >= 0) Then Hoja7.Cells(32, 2) = CDbl(BI.Text) End If End If BI.Text = Hoja7.Range("B32") CP.Caption = " " & Hoja7.Range("D34") End Sub Private Sub B1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Double

Config - 3 Hoja7.Activate If IsNumeric(B1.Text) Then Dtemp = CDbl(B1.Text) If (Dtemp <= 100 And Dtemp >= 0) Then Hoja7.Cells(33, 2) = CDbl(B1.Text) End If End If B1.Text = Hoja7.Range("B33") CP.Caption = " " & Hoja7.Range("D34") End Sub Private Sub B2_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Double Hoja7.Activate If IsNumeric(B2.Text) Then Dtemp = CDbl(B2.Text) If (Dtemp <= 100 And Dtemp >= 0) Then Hoja7.Cells(34, 2) = CDbl(B2.Text) End If End If B2.Text = Hoja7.Range("B34") CP.Caption = " " & Hoja7.Range("D34") End Sub Private Sub FP_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(38, 2) = Strings.Trim(FP.Text) End Sub Private Sub EC_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(39, 2) = Strings.Trim(EC.Text) End Sub Private Sub DOB_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(40, 2) = Strings.Trim(DOB.Text) End Sub Private Sub FCAP_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Stemp As String Stemp = Strings.Trim(FCAP.Text) Hoja7.Activate If car_raros(Stemp) Then FCAP.Text = Hoja7.Range("B10") Exit Sub End If If IsNumeric(FCAP.Text) = False Then If Len(Stemp) = 3 And Strings.Trim(FCAP.Text) <> "" Then If Strings.Trim(Stemp) <> Hoja7.Cells(11, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(12, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(13, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(14, 2) Then Hoja7.Cells(10, 2) = Strings.Trim(Stemp) End If End If End If End If End If End If FCAP.Text = Hoja7.Range("B10") Filtrocap = FCAP.Text End Sub Private Sub FEC_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Stemp As String Stemp = Strings.Left(Strings.Trim(FEC.Text), 3) Hoja7.Activate If car_raros(Stemp) Then FEC.Text = Hoja7.Range("B11") Exit Sub End If If IsNumeric(FEC.Text) = False Then If Len(Stemp) = 3 And Strings.Trim(FEC.Text) <> "" Then If Strings.Trim(Stemp) <> Hoja7.Cells(10, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(12, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(13, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(14, 2) Then

Config - 4 Hoja7.Cells(11, 2) = Strings.Trim(FEC.Text) End If End If End If End If End If End If FEC.Text = Hoja7.Range("B11") Filtroman = FEC.Text End Sub Private Sub FENC_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Stemp As String Stemp = Strings.Left(Strings.Trim(FENC.Text), 3) Hoja7.Activate If car_raros(Stemp) Then FENC.Text = Hoja7.Range("B12") Exit Sub End If If IsNumeric(FENC.Text) = False Then If Len(Stemp) = 3 And Strings.Trim(FENC.Text) <> "" Then If Strings.Trim(Stemp) <> Hoja7.Cells(10, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(11, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(13, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(14, 2) Then Hoja7.Cells(12, 2) = Strings.Trim(FENC.Text) End If End If End If End If End If End If FENC.Text = Hoja7.Range("B12") Filtromat = FENC.Text End Sub Private Sub FEP_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Stemp As String Stemp = Strings.Left(Strings.Trim(FEP.Text), 3) Hoja7.Activate If car_raros(Stemp) Then FEP.Text = Hoja7.Range("B13") Exit Sub End If If IsNumeric(FEP.Text) = False Then If Len(Stemp) = 3 And Strings.Trim(FEP.Text) <> "" Then If Strings.Trim(Stemp) <> Hoja7.Cells(10, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(11, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(12, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(14, 2) Then Hoja7.Cells(13, 2) = Stemp End If End If End If End If End If End If FEP.Text = Hoja7.Range("B13") Filtromaq = FEP.Text End Sub Private Sub FENP_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Stemp As String Stemp = Strings.Left(Strings.Trim(FENP.Text), 3) Hoja7.Activate If car_raros(Stemp) Then FENP.Text = Hoja7.Range("B14") Exit Sub End If If IsNumeric(FENP.Text) = False Then If Len(Strings.Trim(Stemp)) = 3 And Strings.Trim(FENP.Text) <> "" Then If Strings.Trim(Stemp) <> Hoja7.Cells(10, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(11, 2) Then

Config - 5 If Strings.Trim(Stemp) <> Hoja7.Cells(12, 2) Then If Strings.Trim(Stemp) <> Hoja7.Cells(13, 2) Then Hoja7.Cells(14, 2) = Stemp End If End If End If End If End If End If FENP.Text = Hoja7.Range("B14") Filtrosub = FENP.Text End Sub Private Sub MPC_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales de medicion Dim Dtemp As Integer Hoja7.Activate If IsNumeric(MPC.Text) Then Dtemp = Int(MPC.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(15, 2) = Dtemp recal_med End If End If MPC.Text = Hoja7.Range("B15") format_med = Hoja7.Range("B15") End Sub Private Sub IPC_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales de precio proyecto Dim Dtemp As Integer Hoja7.Activate If IsNumeric(IPC.Text) Then Dtemp = Int(IPC.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(16, 2) = Dtemp End If End If IPC.Text = Hoja7.Range("B16") format_prec = Hoja7.Range("B16") End Sub Private Sub PEMC_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales del importe proyecto Dim Dtemp As Integer Hoja7.Activate If IsNumeric(PEMC.Text) Then Dtemp = Int(PEMC.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(17, 2) = Dtemp End If End If PEMC.Text = Hoja7.Range("B17") format_import = Hoja7.Range("B17") End Sub Private Sub CAB_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales del rendimiento en los descompuestos 'Public format_renrec As String Dim Dtemp As Integer Hoja7.Activate If IsNumeric(CAB.Text) Then Dtemp = Int(CAB.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(18, 2) = Dtemp End If End If CAB.Text = Hoja7.Range("B18") format_renrec = Hoja7.Range("B18") End Sub Private Sub OD_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales de los precios en los descompuestos Dim Dtemp As Integer

Config - 6

Hoja7.Activate If IsNumeric(OD.Text) Then Dtemp = Int(OD.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(19, 2) = Dtemp End If End If OD.Text = Hoja7.Range("B19") format_precrec = Hoja7.Range("B19") End Sub Private Sub IR_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'decimales de los importes de los recursos en los descompuestos Dim Dtemp As Integer Hoja7.Activate If IsNumeric(IR.Text) Then Dtemp = Int(IR.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(20, 2) = Dtemp End If End If IR.Text = Hoja7.Range("B20") format_imprec = Hoja7.Range("B20") End Sub Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'descompuesto de los mediciones descompuestas, ud, long, largo,etc Dim Dtemp As Integer Hoja7.Activate If IsNumeric(TextBox1.Text) Then Dtemp = Int(TextBox1.Text) If (Dtemp <= 5 And Dtemp >= 1) Then Hoja7.Cells(21, 2) = Dtemp recal_med 'recalcula la medicion con los nuevos decimales End If End If TextBox1.Text = Hoja7.Range("B21") format_meddes = Hoja7.Range("B21") End Sub Private Sub FCO_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Date Dim j As Integer j = Hoja7.Cells(6, 2) Hoja7.Activate If j = 0 Then If IsDate(FCO.Text) Then Dtemp = FCO.Text Hoja7.Cells(4, 2) = Dtemp End If End If FCO.Text = Strings.format(Hoja7.Range("B4"), "mmmm-yy") End Sub Private Sub FPRO_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Dtemp As Date Dim j As Integer j = Hoja7.Cells(6, 2) Hoja7.Activate If j = 0 Then If IsDate(FPRO.Text) Then Dtemp = FPRO.Text

Config - 7 Hoja7.Cells(37, 2) = Dtemp End If End If FPRO.Text = Strings.format(Hoja7.Range("B37"), "mmmm-yy") End Sub

Cuadrotexto - 1 Private Sub CommandButton1_Click() Hoja4.Cells(posicionconcepto, 6) = cajatexto.Text Unload Me End Sub Private Sub Izquierda_Click() Dim i, ipoint, Li As Integer Dim posicionconceptotemp As Integer Dim spositionconcepto As Double Hoja4.Cells(posicionconcepto, 6) = cajatexto.Text Li = filaconcepto If Li = 1 Then Exit Sub Else filaconcepto = filaconcepto - 1 spositionconcepto = Hoja7.Range("C26") spositionconcepto = spositionconcepto - 1 End If ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = spositionconcepto Then ipoint = i Exit For End If Next i If i > Ipuntos Then filaconcepto = filaconcepto + 1 Exit Sub End If posicionconceptotemp = 0 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" Then posicionconceptotemp = i + ipuntero + 1 Exit For End If End If Next i If posicionconceptotemp = 0 Then filaconcepto = filaconcepto + 1 Else Hoja7.Activate Hoja7.Range("C26") = spositionconcepto Hoja4.Activate posicionconcepto = posicionconceptotemp

codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 6) End If

End Sub Private Sub Derecha_Click() Dim i, ipoint, Li As Integer Dim posicionconceptotemp As Integer Dim spositionconcepto As Double Hoja4.Cells(posicionconcepto, 6) = cajatexto.Text

Cuadrotexto - 2 Li = filaconcepto If Li >= Reg Then Exit Sub filaconcepto = filaconcepto + 1 spositionconcepto = Hoja7.Range("C26") spositionconcepto = spositionconcepto + 1 ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = spositionconcepto Then ipoint = i Exit For End If Next i If i > Ipuntos Then filaconcepto = filaconcepto - 1 Exit Sub End If posicionconceptotemp = 0 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" Then posicionconceptotemp = i + ipuntero + 1 Exit For End If End If Next i If posicionconceptotemp = 0 Then filaconcepto = filaconcepto - 1 Else Hoja7.Activate Hoja7.Range("C26") = spositionconcepto Hoja4.Activate posicionconcepto = posicionconceptotemp

codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 6) End If End Sub Private Sub nuevo_Click() Dim Respuesta As Integer Respuesta = MsgBox(" Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then cajatexto.Text = "" Hoja4.Cells(posicionconcepto, 6) = "" End If End Sub Private Sub udresumen_Click() End Sub Public Sub UserForm_Activate()

codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = " " & Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 6) End Sub

Cuadrotextoconcep - 1 Option Explicit Private Sub CommandButton1_Click() ponerPasswordEnHoja Hoja4.Cells(posicionconcepto, 9) = cajatexto.Text Unload Me End Sub Private Sub Izquierda_Click() Dim posicionconceptotemp As Integer Dim BBoolean As Boolean Hoja4.Activate Hoja4.Cells(posicionconcepto, 6) = cajatexto.Text BBoolean = True posicionconceptotemp = posicionconcepto Do While BBoolean posicionconceptotemp = posicionconceptotemp - 1 If posicionconceptotemp < (ipuntero + 2) Then Exit Sub If Strings.Trim(Hoja4.Cells(posicionconceptotemp, 1)) = "" Then Exit Sub If Strings.Trim(Hoja4.Cells(posicionconceptotemp, 4)) <> "C" Then BBoolean = False Loop End If posicionconcepto = posicionconceptotemp codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 9) End Sub Private Sub Derecha_Click() Dim posicionconceptotemp As Integer Dim BBoolean As Boolean Hoja4.Activate Hoja4.Cells(posicionconcepto, 6) = cajatexto.Text BBoolean = True posicionconceptotemp = posicionconcepto Do While BBoolean posicionconceptotemp = posicionconceptotemp + 1 If posicionconceptotemp > (ipuntero + 2 + IConceptos) Then Exit Sub If Strings.Trim(Hoja4.Cells(posicionconceptotemp, 1)) = "" Then Exit Sub If Strings.Trim(Hoja4.Cells(posicionconceptotemp, 4)) <> "C" Then BBoolean = False Loop End If

posicionconcepto = posicionconceptotemp codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 9) End Sub Private Sub nuevo_Click() Dim Respuesta As Integer If Hoja4.Cells(posicionconcepto, 9) <> "" Then Respuesta = MsgBox(" Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then cajatexto.Text = "" Hoja4.Cells(posicionconcepto, 9) = "" End If End If End Sub

Cuadrotextoconcep - 2 Public Sub UserForm_Activate()

RemoverPasswordEnHoja Hoja4.Activate codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = " " & Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) cajatexto.Text = Hoja4.Cells(posicionconcepto, 9) End Sub

Edicion - 1 Option Explicit

Private Sub CheckBox2_Click() Hoja7.Cells(97 + Itipo_de_proyecto, 2) = CheckBox2.Value If Itipo_de_proyecto = Inum_cert_paralelo Then Checkconcep.Value = Hoja7.Cells(97 + Inum_cert_paralelo, 2) End If End Sub Private Sub Checkconcep_Click() Hoja7.Cells(97 + Inum_cert_paralelo, 2) = Checkconcep.Value If Itipo_de_proyecto = Inum_cert_paralelo Then CheckBox2.Value = Hoja7.Cells(97 + Inum_cert_paralelo, 2) End If End Sub Private Sub CommandButton2_Click() If B_cerrado = False Then MsgBox "El expediente a importar no ha sido escogido." Else If E_Itipo_expediente = 0 And D_Proy1 Then MsgBox "El expediente de Proyecto no se puede alterar." Else If D_Proy1 = D_Proy2 And nprod1 = nprod2 Then MsgBox "No se puede trasladar medicin. Revisa la seleccin de expedientes." Else trasladar_prod MsgBox "Operacion realizada." End If End If End If End Sub Public Sub UserForm_Activate() carga_estado_inf End Sub Private Sub carga_estado_inf() Dim i, j As Double Dim Rkey As Range Dim Respuesta As Integer

'********************************************************************************* '* '* 1.-CARGA LAS COMBO PARA LA EDICION DE LOS TRABAJOS '* '********************************************************************************* For i = 0 To 18 'ComboBox1.AddItem "Left Center" 'ListIndex = 1 ComboBox1.AddItem Hoja7.Cells(97 + i, 1) Next i ComboBox2.AddItem "vacio" For i = 0 To 18 ComboBox2.AddItem Hoja7.Cells(97 + i, 1) Next i For i = 0 To 40 ComboBox3.AddItem Strings.Trim(Conversion.Str(i)) ComboBox4.AddItem Strings.Trim(Conversion.Str(i))

Edicion - 2 Next i '********************************************************************************* '* '* 2.-CARGA LAS VARIABLES MAS IMPORTANTES DE TRABAJO '* '********************************************************************************* 'Hoja7.Activate 'Hoja7.Cells(97, 2) = 1 'SIEMPRE EN UNO COMO DEFECTO

exitcombo = True ComboBox1.ListIndex = 0 ComboBox2.ListIndex = 0 ComboBox3.ListIndex = 0 ComboBox4.ListIndex = 0 '********************************************************************************* '* '* 3.-CARGA DATOS DEL EXPEDIENTE EN EDICION PRINCIPAL (si tiene produccion y certificacion activado s) '* '********************************************************************************* If Hoja7.Range("B94").Value <> "" Then E_Itipo_expediente = Hoja7.Range("B94") nprod1 = 0 ' indica que numero de certificacion o produccion tiene ComboBox1.ListIndex = Itipo_expediente D_Proy1 = Hoja7.Cells(97 + E_Itipo_expediente, 4) Else E_Itipo_expediente = 0 'quiere decir que esta vacio ComboBox1.ListIndex = 0

End If 'ver si hay archivo de produccion y certificacion abierto a la vez i = E_Itipo_expediente '********************************************************************************* '* '* 4.-ESTUDIA SI HAY EDICION DOBLE O PARALELA '* '********************************************************************************* If Hoja7.Range("B95").Value <> "" Then If Hoja7.Range("B95").Value = 0 Then 'B_edit_inf_paralelo = False Else 'B_edit_inf_paralelo = True End If E_Itipo_expediente_par = Hoja7.Range("B95") B_cerrado = True ComboBox2.ListIndex = CDbl(Hoja7.Range("B95")) + 1 D_Proy2 = Hoja7.Cells(97 + E_Itipo_expediente_par, 4) nprod2 = 0 Else 'si esta vacio no hay edicion del presupuesto paralelo 'B_edit_inf_paralelo = False B_cerrado = False E_Itipo_expediente_par = 0 'quiere decir que esta vacio nprod2 = 0 'indica que numero de certificacion o produccion tiene en la edicion paraleleo ComboBox2.ListIndex = 0 End If exitcombo = False '********************************************************************************* '* '* 5.-DETERMINA NUMERO DE CONCEPTOS Y LOS ORDENA '* '********************************************************************************* 'Ipuntos = ActiveCell.CurrentRegion.Rows.Count End Sub

Edicion - 3 Private Sub ComboBox3_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox3.ListIndex nprod1 = i End Sub Private Sub ComboBox1_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox1.ListIndex If Hoja7.Cells(97 + i, 2) = "" Then exitcombo = True ComboBox1.ListIndex = E_Itipo_expediente exitcombo = False Exit Sub End If 'SE CAMBIA DE EXPEDIENTE nprod1 = 0 'cuando se cambia el expediente el n producc/cert sera cero E_Itipo_expediente = i exitcombo = True ComboBox3.ListIndex = 0 exitcombo = False D_Proy1 = Hoja7.Cells(97 + E_Itipo_expediente, 4) End Sub Private Sub ComboBox2_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox2.ListIndex If 0 = i Then 'no se quiere imprimir informe paralelo B_cerrado = False exitcombo = True ComboBox2.ListIndex = 0 ComboBox4.ListIndex = 0 E_Itipo_expediente_par = 0 D_Proy2 = 0 nprod2 = 0 exitcombo = False Exit Sub ElseIf Hoja7.Cells(97 + (i - 1), 2) = "" Then 'SI NO ESTA ACTIVADO EL EXPEDIENTE FUERA exitcombo = True If B_cerrado = False Then ComboBox2.ListIndex = 0 Else ComboBox2.ListIndex = E_Itipo_expediente_par + 1 'dejarlo como antes End If exitcombo = False Exit Sub End If B_cerrado = True E_Itipo_expediente_par = i - 1 D_Proy2 = Hoja7.Cells(97 + E_Itipo_expediente_par, 4) nprod2 = 0 exitcombo = True

Edicion - 4 ComboBox4.ListIndex = 0 exitcombo = False End Sub Private Sub ComboBox4_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox4.ListIndex nprod2 = i End Sub Private Sub mnuexit_Click() End End Sub

Private Sub Salir_Click() Unload Me End Sub

Informes - 1

Private Sub CommandButton12_Click() Hoja5.Activate Hoja5.Cells(1, 1).FormulaLocal = "COMPARATIVO OBRA CONTRATO/REAL" Hoja5.Cells(2, 2).FormulaLocal = "=AHORA()" Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 1) 2) 3) 4) 5) 11) 12) 13) 14) 15) = = = = = = = = = = "tip." "estructura" "cod." "Ud." "Descripcin" "Precio Venta" "Med. Cont" "Importe Cont." "Med. Real" "Importe Real"

Hoja5.Cells(4, 17) = "Imp. exceso" Hoja5.Cells(4, 18) = "Imp. defecto" IFlagposition1 = 0 IFlagposition2 = 0 IFlagposition3 = 0 IFlagposition4 = 0 presentarcomparativo FFlagposition Hoja5.Activate Range("B2").Select Selection.NumberFormat = "d-m-yy" 'Hoja5.Cells(2, 3) = Strings.Trim(Hoja7.Cells(1, 2)) End Sub Private Sub CommandButton13_Click()

CommandButton12_Click Hoja5.Cells(1, 1).FormulaLocal = "RESUMEN COMPORATIVO MEDICION CONTRATO/REAL DE LA OBRA POR CAPITUL OS" Hoja5.Cells(1, 10).FormulaLocal = "=AHORA()" Rows(4).EntireRow.Clear Hoja5.Cells(4, 13) = "Importe Obra Contrato" Hoja5.Cells(4, 15) = "Importe Obra Medicin Real" deterresumencoste Range("B2").Select Selection.NumberFormat = "d-m-yy" End Sub Private Sub CommandButton14_Click() CommandButton12 End Sub Private Sub CommandButton15_Click() CommandButton13 End Sub

Private Sub CheckBox3_Click() 'Solo prespuestos con Medicin 'B_Pres_Solo_Con_Precio -----------------> false todas las unidades. True solo las que tiene precio

Informes - 2 distinto de 0 If CheckBox3.Value = False Then B_Pres_Solo_Con_Precio = False 'CheckBox3.Caption = "Las mediciones descompuestas no se importan" Else B_Pres_Solo_Con_Precio = True 'CheckBox3.Caption = "Las mediciones descompuestas se importan" End If End Sub Private Sub CheckBox4_Click() 'Solo prespuestos con Medicin 'B_Pres_Solo_Con_Medicion -----------------> false todas las unidades. True solo las que tiene med distinto de 0 If CheckBox4.Value = False Then B_Pres_Solo_Con_Medicion = False 'CheckBox4.Caption = "Las mediciones descompuestas no se importan" Else B_Pres_Solo_Con_Medicion = True 'CheckBox4.Caption = "Las mediciones descompuestas se importan" End If End Sub Private Sub CheckBox5_Click() 'B_Solo_texto_resumido -----------------> True solo texto resumido. False los dos textos If CheckBox5.Value = False Then B_Solo_texto_resumido = False CheckBox5.Caption = "Texto: Texto resumido y extendido" Else B_Solo_texto_resumido = True CheckBox5.Caption = "Texto: Solo texto resumido" End If End Sub

Private Sub ComboBox6_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox6.ListIndex Itipo_de_proyecto = i End Sub Private Sub CommandButton19_Click() pres_presupuesto End Sub Private Sub justificacionprecios_Click() End Sub Private Sub CommandButton20_Click() Dim i As Integer i = CDbl(D1.Text) 'decimeles medicion med_corta i End Sub Private Sub CommandButton21_Click() Dim i As Integer i = CDbl(D1.Text) ' D1 corresponde a las mediciones (no a los rendimientos) med_sys i End Sub Private Sub CommandButton8_Click() CommandButton9_Click Hoja5.Cells(1, 1).FormulaLocal = "RESUMEN DEL COSTE PLANIFICADO DE LA OBRA POR CAPITULOS" Hoja5.Cells(1, 10).FormulaLocal = "=AHORA()" Hoja5.Cells(4, 1) = ""

Informes - 3 Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 2) 3) 4) 5) = = = = "" "" "" ""

Hoja5.Cells(4, 11) = "" Hoja5.Cells(4, 12) = "" Hoja5.Cells(4, 14) = "" deterresumencoste Range("B2").Select Selection.NumberFormat = "d-m-yy" End Sub Private Sub CommandButton9_Click() Hoja5.Activate Hoja5.Cells(1, 1).FormulaLocal = "RELACION COSTE OBRA PLANIFICADA" Hoja5.Cells(2, 2).FormulaLocal = "=AHORA()" Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 1) 2) 3) 4) 5) = = = = = "tip." "estructura" "cod." "Ud." "Descripcin"

Hoja5.Cells(4, 11) = "Med. Pendiente" Hoja5.Cells(4, 12) = "Coste" Hoja5.Cells(4, 13) = "Total Coste" Hoja5.Cells(4, 14) = "Precio Venta" 'Hoja5.Cells(4, 15) = "Medicin" Hoja5.Cells(4, 15) = "Importe Venta" Hoja5.Cells(4, 16) = "Cd/Prod" Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 18) 19) 20) 21) 22) 23) 24) 25) 26) = = = = = = = = = "Tot. "Tot. "Tot. "Tot. "Tot. "Tot. "Tot. "Tot. "Tot. C. Sin def." C. MO." '1 C. Mat." '2 C. Maq. Pr." '3 C. Maq. Al." '4 C. Subcon." '5 C. Indus." '6 C. Instal." '7 Otros C." '8

IFlagposition1 = 0 IFlagposition2 = 0 IFlagposition3 = 0 IFlagposition4 = 0 presentarcosteplanificado FFlagposition Hoja5.Activate Range("B2").Select Selection.NumberFormat = "d-m-yy" 'Hoja5.Cells(2, 3) = Strings.Trim(Hoja7.Cells(1, 2)) End Sub Private Sub CommandButton1_Click() Dim Scadena As String Dim Dtechaactual As Date

Dtechaactual = Hoja7.Cells(4, 2) Dtechaactual = DateAdd("m", (Mesenproduccion - 1), Dtechaactual) Scadena = "DEL MES n " & Strings.Trim(Mesenproduccion) & "- " & format$(Dtechaactual, "mmmm yyyy") Hoja5.Activate Hoja5.Cells(1, 1).FormulaLocal = "RELACION DE PRODUCCION " & Scadena Hoja5.Cells(2, 2).FormulaLocal = "=AHORA()" Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 1) = "tip." 2) = "estructura" 3) = "cod." 4) = "Ud." 5) = "Descripcin" 11) = "Precio Venta"

Informes - 4 Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, 12) 13) 14) 15) = = = = "Medicin" "Importe Obra" "Prod. Mes" "Importe Prod. Mes"

IFlagposition1 = 0 IFlagposition2 = 0 IFlagposition3 = 0 IFlagposition4 = 0 presentarprod FFlagposition Hoja5.Activate Range("B2").Select Selection.NumberFormat = "d-m-yy" End Sub Private Sub CommandButton10_Click() CommandButton5_Click End Sub Private Sub CommandButton11_Click() CommandButton6_Click End Sub Private Sub CommandButton22_Click() Dim i As Integer Dim Bpresenta As Boolean Dim filt As String

Bpresenta = CheckBox1.Value 'false presenta todos los conceptos indep de que esten en el presupuest o filt = TextBox1.Text i = CDbl(D2.Text) 'decimales de precios presenta_cp1 i, Bpresenta, filt End Sub Private Sub CommandButton23_Click() pres_presupuesto_sys End Sub Private Sub CommandButton24_Click() Dim i As Integer Dim ii As Integer Dim iii As Integer Dim filt As String i = CDbl(D1.Text) 'decimeles medicion ii = CDbl(D2.Text) 'decimales de precio iii = CDbl(D3.Text) 'decimales de importes filt = TextBox1.Text pres_presupuesto_plano ii, i, iii End Sub

Private Sub CommandButton27_Click() 'informe_actaprecios Dim i As Integer Dim ii As Integer Dim filt As String i = CDbl(D5.Text) ii = CDbl(D4.Text) filt = TextBox1.Text informe_actaprecios i, ii, filt End Sub

Informes - 5 Private Sub CommandButton28_Click() Dim i As Integer Dim ii As Integer Dim iii As Integer Dim iiii As Integer i = CDbl(D1.Text) 'decimeles medicion de proyecto ii = CDbl(D2.Text) 'decimales de precio iii = CDbl(D3.Text) 'decimales de importes iiii = CDbl(D7.Text) 'decimales de importes presymed i, ii, iii, iiii End Sub Private Sub CommandButton29_Click() Dim i As Integer Dim ii As Integer 'Dim iii As Integer 'Dim iiii As Integer i = CDbl(D1.Text) 'decimeles medicion de proyecto 'ii = CDbl(D2.Text) 'decimales de precio 'iii = CDbl(D3.Text) 'decimales de importes ii = CDbl(D7.Text) 'decimales de importes inf_med i, ii End Sub Private Sub CommandButton30_Click() Dim i As Integer Dim ii As Integer Dim iii As Integer Dim D_Proy_temp As Double Dim Itipo_de_proyecto_temp As Double Dim filt As String i = CDbl(D1.Text) 'decimeles medicion ii = CDbl(D2.Text) 'decimales de precio iii = CDbl(D3.Text) 'decimales de importes filt = TextBox1.Text D_Proy_temp = D_Proy 'D_Proy_paralelo = 0 'Itipo_de_proyecto e'el numero de cert o produccion Itipo_de_proyecto_temp = Itipo_de_proyecto 'Itipo_expediente_par = Hoja7.Range("B95") 'D_Proy_paralelo = Hoja7.Cells(97 + Itipo_expediente_par, 4) 'Inum_cert_paralelo = 0 'el n de certificacion del paralelo pres_presupuesto_plano ii, i, iii 'inf_pres_proy i, ii, iii 'este informe no vale para nada If B_edit_inf_paralelo = False Then Exit Sub 'se ponen las variables del expediente y numero de certificacin/prod D_Proy = D_Proy_paralelo Itipo_de_proyecto = Inum_cert_paralelo pres_presupuesto_doble ii, i, iii D_Proy = D_Proy_temp Itipo_de_proyecto = Itipo_de_proyecto_temp End Sub

Private Sub CommandButton32_Click() Dim i As Integer Dim ii As Integer Dim iii As Integer Dim filt As String i = CDbl(D1.Text) 'decimeles medicion

Informes - 6 ii = CDbl(D2.Text) 'decimales de precio iii = CDbl(D3.Text) 'decimales de importes filt = TextBox1.Text pres_presupuesto_presto ii, i, iii End Sub Private Sub CommandButton33_Click() Dim i As Integer Dim Bpresenta As Boolean Dim filt As String

Bpresenta = CheckBox1.Value 'false presenta todos los conceptos indep de que esten en el presupuest o 'MPC.Text = Hoja7.Range("B15") filt = TextBox1.Text i = CDbl(D2.Text) 'decimales de precios presenta_todos i, Bpresenta, filt End Sub Private Sub CommandButton4_Click() Dim i As Integer Dim filt As String filt = TextBox1.Text i = CDbl(D6.Text) presenta_cp2ADIF i, filt End Sub Private Sub CommandButton5_Click() IFlagposition1 IFlagposition2 IFlagposition3 IFlagposition4 Hoja5.Activate Hoja5.Cells(1, = = = = 0 0 0 0

1).FormulaLocal = "PRESUPUESTO OBRA"

Hoja5.Cells(2, 2).FormulaLocal = "=AHORA()" Range("B2").Select Selection.NumberFormat = "d-m-yy" Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, presentarobra FFlagposition 'Hoja5.Cells(2, 3) = Strings.Trim(Hoja7.Cells(1, 2)) End Sub Private Sub CommandButton6_Click() CommandButton5_Click Hoja5.Cells(1, 1).FormulaLocal = "RESUMEN PRESUPUESTO DE LA OBRA POR CAPITULOS" Hoja5.Cells(1, 10).FormulaLocal = "=AHORA()" Rows(4).Select Selection.EntireRow.Clear Hoja5.Cells(4, 13) = "Importe Obra" deterresumencoste Range("B2").Select Selection.NumberFormat = "d-m-yy" 1) = "tip." 2) = "estructura" 3) = "cod." 4) = "Ud." 5) = "Descripcin" 11) = "Precio Venta" 12) = "Medicin" 13) = "Importe Venta"

Informes - 7 End Sub Private Sub CommandButton7_Click() Dim Scadena As String Dim Dtechaactual As Date

Dtechaactual = Hoja7.Cells(4, 2) Dtechaactual = DateAdd("m", (Mesenproduccion - 1), Dtechaactual) Scadena = "DEL MES n " & Strings.Trim(Mesenproduccion) & "- " & format$(Dtechaactual, "mmmm yyyy") Hoja5.Activate CommandButton1_Click Hoja5.Cells(1, 1).FormulaLocal = "RESUMEN DE LA PRODUCCION OBRA POR CAPITULOS" Hoja5.Cells(1, 10).FormulaLocal = "=AHORA()" Rows(4).Select Selection.EntireRow.Clear Hoja5.Cells(4, 13) = "Importe Obra" Hoja5.Cells(4, 15) = "Importe Prod. Mes" deterresumencoste Range("B2").Select Selection.NumberFormat = "d-m-yy" End Sub Private Sub Compara_Click() 'Realiza la comparacin mensual pero del ltimo mes cerrado 'esto es Hoja7.Cells(3, 2) Dim i As Integer Dim Dtemp As Double Dim nmessa As Integer Dim Dcalculosprop As Double Hoja8.Activate ipuntero = Hoja7.Range("B23") Hoja8.Cells(1, 1) = Strings.Trim(Hoja7.Cells(1, 2)) Hoja8.Cells(2, 1) = "COMPARACION MENSUAL DEL MES N " & Strings.Trim(Hoja7.Cells(3, 2)) Hoja8.Cells(4, 2) = CDbl(Hoja7.Cells(8, 2)) Hoja8.Cells(4, 6) = CDbl(Hoja7.Cells(7, 2)) Mesdeseguimiento = Hoja7.Cells(3, 2) If Mesdeseguimiento = 0 Then Exit Sub Dtemp = Hoja1.Cells(39, 3 + Mesdeseguimiento) Hoja8.Cells(7, 3) = Dtemp Hoja3.Activate nmessa = Mesdeseguimiento - Mesactualizacion Dcalculosprop = (Mesdeseguimiento - Mesactualizacion) / CDbl(Hoja7.Cells(5, 2))

Range("F29:IV48").Select Selection.Copy Range("F152").Select ActiveSheet.Paste Range("F51:IV70").Select Selection.Copy Range("F174").Select ActiveSheet.Paste Range("F73:IV92").Select Selection.Copy Range("F196").Select ActiveSheet.Paste Range("F95:IV114").Select Selection.Copy Range("F218").Select ActiveSheet.Paste

Informes - 8 Range("D29:D48").Select Selection.Copy Range("D152").Select ActiveSheet.Paste Range("D51:D70").Select Selection.Copy Range("D174").Select ActiveSheet.Paste Range("D73:D92").Select Selection.Copy Range("D196").Select ActiveSheet.Paste Range("D95:D114").Select Selection.Copy Range("D218").Select ActiveSheet.Paste Hoja3.Cells(124, 3) = Dtemp - Hoja1.Cells(39, 3 + Mesactualizacion) For i = 1 To 9 If Dcalculosprop <> 0 Then Hoja3.Cells(126 + i, 4) = CDbl(Hoja3.Cells(5 + i, 4 + 4 * Edition)) / Dcalculosprop Else Hoja3.Cells(126 + i, 4) = 0 End If Hoja3.Cells(126 + i, 5) = Hoja3.Cells(5 + i, 5 + 4 * Edition) '/ Dcalculosprop Next i For i = 1 To 3 If Dcalculosprop <> 0 Then Hoja3.Cells(139 + i, 4) = CDbl(Hoja3.Cells(18 + i, 4 + 4 * Edition)) / Dcalculosprop Else Hoja3.Cells(139 + i, 4) = 0 End If Hoja3.Cells(139 + i, 5) = Hoja3.Cells(18 + i, 5 + 4 * Edition) '/ Dcalculosprop Next i If Edition <> 0 Then j = CDbl(Hoja7.Cells(108 + Edition, 2)) For m = 5 + Mesdeseguimiento + 1 To Mesdeseguimiento + 100 For n = 152 To 171 Hoja3.Cells(n, Next n For n = 174 To 193 Hoja3.Cells(n, Next n For n = 196 To 215 Hoja3.Cells(n, Next n For n = 218 To 237 Hoja3.Cells(n, Next n Next m

m) = "" m) = "" m) = "" m) = ""

End If Hoja8.Activate For i = 1 To 9 Hoja8.Cells(21 + i, 4) = Hoja3.Cells(126 + i, 3) Next i For i = 1 To 3 Hoja8.Cells(33 + i, 4) = Hoja3.Cells(139 + i, 3) Next i For i = 1 To 8 Hoja8.Cells(9 + i, 3) = Hoja1.Cells(6 + i, 3 + Mesdeseguimiento) Next i For i = 1 To 9 Hoja8.Cells(21 + i, 3) = Hoja1.Cells(17 + i, 3 + Mesdeseguimiento) Next i For i = 1 To 3 Hoja8.Cells(33 + i, 3) = Hoja1.Cells(29 + i, 3 + Mesdeseguimiento) Next i For i = 1 To 8

Informes - 9 Hoja8.Cells(9 + i, 4) = Hoja1.Cells(6 + i, 3 + Mesactualizacion) Next i For i = 1 To 9 Hoja8.Cells(21 + i, 4) = Hoja8.Cells(21 + i, 4) + Hoja1.Cells(17 + i, 3 + Mesactualizacion) Next i For i = 1 To 3 Hoja8.Cells(33 + i, 4) = Hoja8.Cells(33 + i, 4) + Hoja1.Cells(29 + i, 3 + Mesactualizacion) Next i DeterminanaturalezaCosteseg End Sub Private Sub jp_Click() Dim i As Integer Dim ii As Integer Dim filt As String i = CDbl(D5.Text) ii = CDbl(D4.Text) filt = TextBox1.Text informe_jprecios i, ii, filt End Sub Private Sub MultiPage1_Change() End Sub Private Sub Salir_Click() End End Sub Private Sub CommandButton2_Click() Hoja5.Activate Hoja5.Cells(1, 1).FormulaLocal = "RELACION COSTE OBRA PLANIFICADA" Hoja5.Cells(2, 2).FormulaLocal = "=AHORA()" 'Hoja5.Cells(2, 3) = Strings.Trim(Hoja7.Cells(1, 2)) Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, Hoja5.Cells(4, IFlagposition1 IFlagposition2 IFlagposition3 IFlagposition4 presentarcoste FFlagposition Hoja5.Activate 1) = "tip." 2) = "estructura" 3) = "cod." 4) = "Ud." 5) = "Descripcin" 11) = "Coste" 12) = "Med. Coste" 13) = "Total Coste" 14) = "Precio Venta" 15) = "Medicin" 16) = "Importe Venta" 17) = "Cd/Prod" 18) = "Cost. Sin def." 19) = "Coste MO." '1 20) = "Coste Mat." '2 21) = "Coste Maq. Pr." '3 22) = "Coste Maq. Alq." '4 23) = "Coste Subcon." '5 24) = "Coste Industrial" '6 25) = "Coste Instal." '7 26) = "Costes Otros " '8 27) = "Tot. C. Sin def." 28) = "Tot. C. MO." '1 29) = "Tot. C. Mat." '2 30) = "Tot. C. Maq. Pr." '3 31) = "Tot. C. Maq. Al." '4 32) = "Tot. C. Subcon." '5 33) = "Tot. C. Indus." '6 34) = "Tot. C. Instal." '7 35) = "Tot. Otros C." '8 = = = = 0 0 0 0

Informes - 10 Columns("J:J").Select Selection.EntireColumn.Hidden = True Columns("H:H").Select Selection.EntireColumn.Hidden = True Columns("I:I").Select Selection.EntireColumn.Hidden = True End Sub Private Sub Scrollmes_Change() Dim Dtechaactual As Date Dim j As Integer j = 0 If Edition <> 0 Then j = CDbl(Hoja7.Cells(108 + Edition, 2)) End If Mesenproduccion = Scrollmes.Value If j >= Mesenproduccion Then Mesenproduccion = j + 1 End If Scrollmes.Value = Mesenproduccion

Dtechaactual = Hoja7.Cells(4, 2) Dtechaactual = DateAdd("m", (Mesenproduccion - 1), Dtechaactual) Fecha.Caption = "Mes n " & Strings.Trim(Mesenproduccion) & "- " & format$(Dtechaactual, "mmmm yyyy ") End Sub Private Sub TextBox1_Change() End Sub Public Sub UserForm_Activate() Dim j, i As Integer Application.ScreenUpdating = False Hoja5.Activate

TextBox1.Text = "*" ipuntero = Hoja7.Range("B23") CheckBox1.Value = True ' activado->presenta solo partidas del presupuesto, desactivado->presenta to dos los conceptos 'B_Pres_Solo_Con_Precio = CheckBox4.Value = False 'todas las partidas del presupuesto CheckBox3.Value = False 'todas las partidas del presupuesto CheckBox5.Value = True 'solo texto resumido D1.Text D2.Text D3.Text D4.Text D5.Text D6.Text D7.Text = = = = = = = 2 2 2 4 2 4 3 'decimales mediciones 'decimales de precios 'decimales precios em y resumenes ' decimales importes dentro de rendimientos 'precio descompuestos para cuadros y descompuestos 'rendimiento mediciones descompuestas

'i = CDbl(D5.Text) 'ii = CDbl(D4.Text) 'MPC.Text = Hoja7.Range("B18") 'decimales importes dentro de rendimientos carga_estado_inf Hoja5.Activate End Sub Function reset() Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Dim format(0 To 4) As String restaurarocultar

Informes - 11 Base = Hoja7.Range("B26") Sposicion = Hoja7.Range("C26") ipuntero = Hoja7.Range("B23") IConceptos = 0 Ipuntos = 0 Hoja4.Activate Hoja5.Activate Range("A1:AZ100").Select Selection.Style = "Normal" Selection.Clear Rows("4:4").Select With Selection.Font .Name = "Arial" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Range("B2").Select Selection.NumberFormat = "d-m-yy" Hoja8.Activate Range("A2").Select Selection.ClearContents Range("c10:d18").Select Selection.ClearContents Range("F10:F18").Select Selection.ClearContents Range("c22:d30").Select Selection.ClearContents Range("f22:f30").Select Selection.ClearContents Range("b4").Select Selection.ClearContents Range("f4").Select Selection.ClearContents Range("c34:d36").Select Selection.ClearContents Range("f34:f36").Select Selection.ClearContents Range("f5").Select ' fecha Selection.ClearContents Range("c7").Select ' produccion Selection.ClearContents Range("A1").Select ' Nombre de la obra Selection.ClearContents Hoja5.Activate j = 0 Do While IsEmpty(Hoja4.Cells(j + 1, 1)) = False j = j + 1 Loop Ipuntos = j j = 0 Do While IsEmpty(Hoja4.Cells(ipuntero + 1 + j + 1, 1)) = False j = j + 1 Loop IConceptos = j End Function Private Sub titular() Dim Stemp As String ActiveSheet.Shapes("AutoShape 198").Select Selection.Characters.Text = " " & Chr(10) & "" & Chr(10) & ""

Informes - 12 With Selection.Characters(Start:=1, Length:=2).Font .Name = "Verdana" .FontStyle = "Negrita" .Size = 14 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 9 End With With Selection.Characters(Start:=3, Length:=1).Font .Name = "Verdana" .FontStyle = "Negrita" .Size = 14 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 9 End With Range("K1").Select Stemp = Strings.Trim(Hoja7.Cells(1, 2)) ActiveSheet.Shapes("AutoShape 198").Select Selection.Characters.Text = " " & Chr(10) & Stemp & Chr(10) & "" With Selection.Characters(Start:=1, Length:=24).Font .Name = "Verdana" .FontStyle = "Negrita" .Size = 14 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 9 End With Selection.HorizontalAlignment = xlCenter End Sub Private Sub carga_estado_inf() Dim i, j As Double Dim Rkey As Range Dim Respuesta As Integer '********************************************************************************* '* '* 1.-CARGA LAS COMBO PARA LA EDICION DE LOS TRABAJOS '* '********************************************************************************* For i = 0 To 18 'ComboBox1.AddItem "Left Center" 'ListIndex = 1 ComboBox1.AddItem Hoja7.Cells(97 + i, 1) Next i For i = 0 To 18 ComboBox5.AddItem Hoja7.Cells(97 + i, 1) Next i ComboBox2.AddItem "vacio" For i = 0 To 18 'ComboBox1.AddItem "Left Center" 'ListIndex = 1 ComboBox2.AddItem Hoja7.Cells(97 + i, 1) Next i For i = 0 To 80 'ComboBox1.AddItem "Left Center" 'ListIndex = 1 ComboBox3.AddItem ComboBox4.AddItem ComboBox6.AddItem ComboBox7.AddItem Next i Strings.Trim(Conversion.Str(i)) Strings.Trim(Conversion.Str(i)) Strings.Trim(Conversion.Str(i)) Strings.Trim(Conversion.Str(i))

Informes - 13 '********************************************************************************* '* '* 2.-CARGA LAS VARIABLES MAS IMPORTANTES DE TRABAJO '* '********************************************************************************* Hoja7.Activate Hoja7.Cells(97, 2) = 1 'SIEMPRE EN UNO COMO DEFECTO

exitcombo = True ComboBox1.ListIndex = 0 ComboBox2.ListIndex = 0 ComboBox3.ListIndex = 0 ComboBox4.ListIndex = 0 ComboBox5.ListIndex = 0 ComboBox6.ListIndex = 0 ComboBox7.ListIndex = 0 '********************************************************************************* '* '* 3.-CARGA DATOS DEL EXPEDIENTE EN EDICION PRINCIPAL (si tiene produccion y certificacion activado s) '* '********************************************************************************* If Hoja7.Range("B94").Value <> "" Then Itipo_expediente = Hoja7.Range("B94") Itipo_de_proyecto = 0 ' indica que numero de certificacion o produccion tiene ComboBox1.ListIndex = Itipo_expediente ComboBox5.ListIndex = Itipo_expediente D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) Else Itipo_expediente = 0 'quiere decir que esta vacio ComboBox1.ListIndex = 0 ComboBox5.ListIndex = 0 'Hoja7.Range("B94").Value = 0

End If 'ver si hay archivo de produccion y certificacion abierto a la vez i = Itipo_expediente '********************************************************************************* '* '* 4.-ESTUDIA SI HAY EDICION DOBLE O PARALELA '* '*********************************************************************************

If Hoja7.Range("B95").Value <> "" Then If Hoja7.Range("B95").Value = 0 Then B_edit_inf_paralelo = False Else B_edit_inf_paralelo = True End If B_cerrado = True Itipo_expediente_par = Hoja7.Range("B95") ComboBox2.ListIndex = CDbl(Hoja7.Range("B95")) + 1 D_Proy_paralelo = Hoja7.Cells(97 + Itipo_expediente_par, 4) Inum_cert_paralelo = 0 'indica que numero de certificacion o produccion tiene en la edicion paraleleo 'B_volcar_bis = True Else 'si esta vacio no hay edicion del presupuesto paralelo B_edit_inf_paralelo = False B_cerrado = False Itipo_expediente_par = 0 'quiere decir que esta vacio Inum_cert_paralelo = 0 'indica que numero de certificacion o produccion tiene en la edicion paraleleo ComboBox2.ListIndex = 0 End If exitcombo = False '********************************************************************************* '* '* 5.-DETERMINA NUMERO DE CONCEPTOS Y LOS ORDENA '*

Informes - 14 '********************************************************************************* Hoja4.Activate Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ordenarpresupuesto ordenarconcepto

End Sub Private Sub ComboBox3_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox3.ListIndex Itipo_de_proyecto = i End Sub Private Sub ComboBox1_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox1.ListIndex 'D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) If Hoja7.Cells(97 + i, 2) = "" Then exitcombo = True ComboBox1.ListIndex = Itipo_expediente ComboBox5.ListIndex = Itipo_expediente exitcombo = False Exit Sub End If 'SE CAMBIA DE EXPEDIENTE Itipo_de_proyecto = 0 'cuando se cambia el expediente el n producc/cert sera cero Itipo_expediente = i exitcombo = True ComboBox5.ListIndex = ComboBox1.ListIndex ComboBox3.ListIndex = 0 exitcombo = False D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) End Sub Private Sub ComboBox5_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox5.ListIndex If Hoja7.Cells(97 + i, 2) = "" Then exitcombo = True ComboBox1.ListIndex = Itipo_expediente ComboBox5.ListIndex = Itipo_expediente exitcombo = False Exit Sub End If 'SE CAMBIA DE EXPEDIENTE Itipo_de_proyecto = 0 'cuando se cambia el expediente el n producc/cert sera cero Itipo_expediente = i exitcombo = True ComboBox1.ListIndex = ComboBox5.ListIndex ComboBox3.ListIndex = 0

Informes - 15 exitcombo = False D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) End Sub Private Sub ComboBox2_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox2.ListIndex If 0 = i Then 'no se quiere imprimir informe paralelo B_cerrado = False exitcombo = True ComboBox2.ListIndex = 0 ComboBox4.ListIndex = 0 'B_volcar_bis = False 'QUITAR EDICION EN PARALELO Itipo_expediente_par = -1 Inum_cert_paralelo = 0 D_Proy_paralelo = 0 B_edit_inf_paralelo = False exitcombo = False Exit Sub ElseIf Hoja7.Cells(97 + (i - 1), 2) = "" Then 'SI NO ESTA ACTIVADO EL EXPEDIENTE FUERA exitcombo = True If B_cerrado = False Then ComboBox2.ListIndex = 0 Else ComboBox2.ListIndex = Itipo_expediente_par + 1 'dejarlo como antes End If exitcombo = False B_volcar_bis = False Exit Sub End If B_cerrado = True Itipo_expediente_par = i - 1 D_Proy_paralelo = Hoja7.Cells(97 + Itipo_expediente_par, 4) B_edit_inf_paralelo = True Inum_cert_paralelo = 0 'cuando se cambia el expediente el n producc/cert sera cero exitcombo = True ComboBox4.ListIndex = 0 exitcombo = False End Sub Private Sub ComboBox4_Change() Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox4.ListIndex Inum_cert_paralelo = i End Sub

Medic - 1

Option Explicit Private Sub BRecurso_Click() Dim i, ipoint, Li As Integer Dim Celda1, Celda4 As Range Dim j As Integer If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If Hoja1.Activate ' LA DE MEDICIONES j = Int(TextBox8.Text) 'numero de lineas de la casilla de texto Li = Lastrowdis + 1 i = 0 If Li >= Regdis Then Exit Sub If Li <= 0 Then Exit Sub Hoja1.Range("HU3") = "" Hoja1.Range("HU4:IF2000").ClearContents ' VEMOS EL NUMERO DE LINEAS QUE SE PUEDEN COPIAR Do While CDbl(Hoja1.Cells(Li + posicionmedicion + 1, If j = 0 Then Exit Do i = i + 1 j = j - 1 Loop If i = 0 Then Exit Sub ElseIf i = 1 Then Set Celda1 = Hoja1.Cells(Li + posicionmedicion + Set Celda4 = Hoja1.Cells(Li + posicionmedicion + Else 'solo una linea para copiar Set Celda1 = Hoja1.Cells(Li + posicionmedicion + Set Celda4 = Hoja1.Cells(Li + posicionmedicion + End If Hoja1.Range("HU3") = i Hoja1.Range(Celda1, Celda4).Copy Range("HU4") End Sub Private Sub CommandButton1_Click() 'INSERTAR LINEA Dim Li As Integer If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If Hoja1.Activate ' LA DE MEDICIONES Li = Lastrowdis + 1 'Li = Medic.Cuadrodis.ActiveCell.Row - 1 If Li >= Regdis Then Exit Sub If Li <= 0 Then Exit Sub crearhueco_med volcardis 'PEGAR ListBox1_Click End Sub Private Sub Eliminar_Click() Dim i, ipoint, Li As Integer 3 + pos_med_col)) <> 0

1, 1 + pos_med_col) 1, 12 + pos_med_col) 1, 1 + pos_med_col) 1 + (i - 1), 12 + pos_med_col)

Medic - 2 Dim Celda1, Celda4 As Range Dim j As Integer Hoja1.Activate ' LA DE MEDICIONES If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If j = Int(TextBox8.Text) 'numero de lineas de la casilla de texto Li = Lastrowdis + 1 If Li >= Regdis Then Exit Sub If Li <= 0 Then Exit Sub Do While CDbl(j) <> 0

If 2 = Regdis And Li = 1 Then ' solo esta esa linea y por su puesto no se borra pero si su cont enido Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Medic.ListBox1.ListIndex = 0 'limpiardis Else + + + + + + + + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 + pos_med_col) = "" 5 + pos_med_col) = "" 6 + pos_med_col) = "" 7 + pos_med_col) = "" 8 + pos_med_col) = "" 9 + pos_med_col) = "" 10 + pos_med_col) = "" 11 + pos_med_col) = "" 12 + pos_med_col) = ""

If Li <> Regdis Then Set Celda1 = Hoja1.Cells(Li + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(Li + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis

Loop limpiardis volcardis End Sub

End If End If j = j - 1 Regdis = Regdis - 1

Private Sub ListBox1_Click() Dim i As Integer If Binsertarlineamed = True Then 'eliminarnuevalineamed i = D_linea_insert 'Exit Sub Else i = ListBox1.ListIndex End If

Lastrowdis = i 'EventInfo.Range.Row TextBox1.Text = ListBox1.List(i, 0) TextBox2.Text = ListBox1.List(i, 1) TextBox3.Text = ListBox1.List(i, 2)

Medic - 3 TextBox4.Text = ListBox1.List(i, 3) TextBox5.Text = ListBox1.List(i, 4) Label2.Caption = ListBox1.List(i, 5) TextBox7.Text = ListBox1.List(i, 6) End Sub

Private Sub Pega_Click() Dim i, j, Li As Integer Dim Celda1, Celda4 As Range Dim Stemp As String Hoja1.Activate ' LA DE MEDICIONES If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If Li = Lastrowdis + 1 i = Hoja1.Range("HU3") If Li > Regdis Then Exit Sub If Li <= 0 Then Exit Sub If i = 0 Then ElseIf i = 1 Then 'solo una linea para copiar Set Celda1 = Hoja1.Cells(4, 229) Set Celda4 = Hoja1.Cells(4 + (i - 1), 240) Hoja1.Range(Celda1, Celda4).Select Selection.Copy Set Celda1 = Hoja1.Cells((Li) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Li) + posicionmedicion + 1, 12 + pos_med_col)

Hoja1.Range(Celda1, Celda4).Select Selection.Insert Shift:=xlDown Stemp = Hoja1.Cells((Li) + posicionmedicion + 1, 10 + pos_med_col) If Strings.Trim(Stemp) <> "" Then Hoja1.Cells((Li) + posicionmedicion + 1, 11 + pos_med_col).FormulaLocal = "=" & Strings.Tri m(Stemp) End If Else If Bdescomposicionmed = False Then 'se elimina la linea existente que esta vacia Set Celda1 = Hoja1.Cells(posicionmedicion + 2, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp End If Set Celda1 = Hoja1.Cells(4, 229) Set Celda4 = Hoja1.Cells(4 + (i - 1), 240)

Hoja1.Range(Celda1, Celda4).Select Selection.Copy Set Celda1 = Hoja1.Cells((Li) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Li) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Select Selection.Insert Shift:=xlDown For j = 0 To i - 1 Stemp = Hoja1.Cells((Li) + posicionmedicion + 1 + j, 10 + pos_med_col) If Strings.Trim(Stemp) <> "" Then Hoja1.Cells((Li) + posicionmedicion + 1 + j, 11 + pos_med_col).FormulaLocal = "=" & Str ings.Trim(Stemp) End If Next j End If

Medic - 4 limpiardis volcardis

End Sub Private Sub Izquierda_Click() Dim i, ipoint As Integer Dim posicionconceptotemp As Double Dim spositionconcepto As Double Dim Li As Long Dim Celda1, Celda4 As Range Dim Celda2 As Range Dim Dtemp_1 As Integer Dim Dtemp_2 As Integer Dim Dtemp_3 As Integer Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Dim Respuesta As Integer On Error Resume Next If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If actualizar_ref_mediciones Li = filamedicion If Li = 1 Then Exit Sub Else filamedicion = filamedicion - 1 spositionconcepto = Hoja7.Range("C26") spositionconcepto = spositionconcepto - 1 End If ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = spositionconcepto Then ipoint = i Exit For End If Next i If i > Ipuntos Then filamedicion = filamedicion + 1 Exit Sub End If posicionconceptotemp = 0 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then posicionconceptotemp = i + ipuntero + 1 Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) = "C" Or Hoja4.Cells(i + ipuntero + 1, 4) = "%" Then Exit Sub '*********************************************************************************** If posicionconceptotemp = 0 Then filamedicion = filamedicion + 1 Else Hoja7.Activate Hoja7.Range("C26") = spositionconcepto posicionconcepto = posicionconceptotemp 'antes de irnos introducimos el resultado de la medicin descompuesta en la hoja 4

Medic - 5 ' si no hay borramos toda referencia Hoja4.Activate If Bdescomposicionmed Then 'si hay medicion descompuesta aunque sea texto

Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = CDbl(Hoja1.Cells(posicion medicion, 1 + pos_med_col)) Else eliminar_medicion_desc (ipoint_med + D_Proy) Hoja4.Activate Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" End If ipoint_med = ipoint

, 3)

codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = " " & Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto If Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then 'tiene medicin descompuesta 'funciona de la siguiente manera 'siempre que la columna 9 este ocupada quiere decir que hay medicin descompuesta 'al salir del cuadro de mediciones se rellenara la columna n 4 If Err = 0 Then stemp1 = Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column 'posicionmedicion = SolamenteNumeros(stemp1) 'stemp1 = SolamenteRef(stemp1) 'stemp2 = "=COLUMNA(" & stemp1 & ")" 'Hoja4.Cells(iPuntero - 1, 1).FormulaLocal = stemp2 'pos_med_col = CDbl(Hoja4.Cells(iPuntero - 1, 1)) pos_med_col = pos_med_col - 1 'Hoja4.Cells(iPuntero - 1, 1) = "" limpiardis volcardis ListBox1.ListIndex = 0 Else

vigor)

Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" 'por tanto no tiene medicion descompuesta Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en End If 'Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row Dtemp_2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row 'Dtemp_1 = CDbl(Hoja1.Cells(1, 2 + pos_med_col)) 'Dtemp_3 = CDbl(Hoja1.Cells(Dtemp_1, 3 + pos_med_col)) 'If Dtemp_3 = 0 Then Dtemp_3 = 1 'Dtemp_2 = CDbl(Hoja1.Cells(1, 2 + pos_med_col)) + 2 + Dtemp_3 + 2 If Dtemp_2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp_2 = 8 End If posicionmedicion = Dtemp_2 Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(6, 12) Set Celda2 = Hoja1.Cells(Dtemp_2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda2, Celda2) Hoja4.Activate

Medic - 6 '* stemp1 = Range(Celda2, Celda2).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = stemp1 limpiardis volcardis ListBox1.ListIndex = 0 Else End If

or)

'no tiene medicion descompuesta Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vig End If 'Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row Dtemp_2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row 'Dtemp_1 = CDbl(Hoja1.Cells(1, 2 + pos_med_col)) 'Dtemp_3 = CDbl(Hoja1.Cells(Dtemp_1, 3 + pos_med_col)) 'If Dtemp_3 = 0 Then Dtemp_3 = 1 'Dtemp_2 = CDbl(Hoja1.Cells(1, 2 + pos_med_col)) + 2 + Dtemp_3 + 2 If Dtemp_2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp_2 = 8 End If posicionmedicion = Dtemp_2 Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(6, 12) Set Celda2 = Hoja1.Cells(Dtemp_2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda2, Celda2) Hoja4.Activate '* stemp1 = Range(Celda2, Celda2).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = stemp1

limpiardis volcardis ListBox1.ListIndex = 0 End If End If 'Cuadrodis.SetFocus End Sub Private Sub Derecha_Click() Dim i, ipoint As Integer Dim posicionconceptotemp As Double Dim spositionconcepto As Double Dim Li As Long Dim Celda1, Celda4 As Range Dim Celda2 As Range Dim Dtemp_1 As Integer Dim Dtemp_2 As Integer Dim Dtemp_3 As Integer Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Dim Respuesta As Integer On Error Resume Next If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If 'salvaultimodatodis actualizar_ref_mediciones

Medic - 7 Li = filamedicion If Li >= Reg Then Exit Sub filamedicion = filamedicion + 1 spositionconcepto = Hoja7.Range("C26") spositionconcepto = spositionconcepto + 1 ipoint = 0 '*********************************************************************************** For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = spositionconcepto Then ipoint = i Exit For End If Next i If i > Ipuntos Then filamedicion = filamedicion - 1 Exit Sub End If posicionconceptotemp = 0 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then posicionconceptotemp = i + ipuntero + 1 Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) = "C" Or Hoja4.Cells(i + ipuntero + 1, 4) = "%" Then Exit Sub '*********************************************************************************** If posicionconceptotemp = 0 Then filamedicion = filamedicion - 1 Else Hoja7.Activate Hoja7.Range("C26") = spositionconcepto posicionconcepto = posicionconceptotemp Hoja4.Activate If Bdescomposicionmed Then 'si hay medicion descompuesta aunque sea texto

Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = CDbl(Hoja1.Cells(posicion medicion, 1 + pos_med_col)) Else '****** eliminar_medicion_desc (ipoint_med + D_Proy) Hoja4.Activate Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" End If ipoint_med = ipoint

, 3)

Hoja4.Activate codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = " " & Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto If Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then '**** If Err = 0 Then

'tiene medicin descompuesta 'funciona de la siguiente manera 'siempre que la columna 9 este ocupada quiere decir que hay medicin descompuesta 'al salir del cuadro de mediciones se rellenara la columna n 4 stemp1 = Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row

Medic - 8 pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 limpiardis volcardis ListBox1.ListIndex = 0

Else

vigor)

Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en End If Dtemp_2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row If Dtemp_2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp_2 = 8 End If posicionmedicion = Dtemp_2 Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(6, 12) Set Celda2 = Hoja1.Cells(Dtemp_2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda2, Celda2) Hoja4.Activate '* stemp1 = Range(Celda2, Celda2).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = stemp1 limpiardis volcardis ListBox1.ListIndex = 0

Else

End If

or)

'no tiene medicion descompuesta Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vig End If Dtemp_2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row If Dtemp_2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp_2 = 8 End If posicionmedicion = Dtemp_2 Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(6, 12) Set Celda2 = Hoja1.Cells(Dtemp_2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda2, Celda2) Hoja4.Activate '* stemp1 = Range(Celda2, Celda2).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = stemp1

limpiardis volcardis ListBox1.ListIndex = 0 End If End If 'Cuadrodis.SetFocus End Sub

Medic - 9 Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Lii As Double Dim Scelda As String Dim i, j As Integer Dim Celda1, Celda4 As Range If exitleavecelldis = False Then Exit Sub Hoja1.Activate Lii = Lastrowdis + 1 Scelda = TextBox1.Text If (Lii) > Regdis Then exitleavecelldis = False TextBox1.Text = ListBox1.List(Lii - 1, 0) exitleavecelldis = True Exit Sub End If If Binsertarlineamed = True Then Binsertarlineamed = False If Strings.Trim(Scelda) = "" Then eliminarnuevalineamed Else Exit Sub

Else

Lii = D_linea_insert + 1 Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") End If 'Continuar como si nada

End If If Strings.Trim(Scelda) = "" Then If Binsertarlineamed = True Then Binsertarlineamed = False Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis Else

If 2 = Regdis Then ' solo esta esa linea y por su puesto no se borra If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") limpiardis End If Else

If (Lii) <> Regdis Then Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells( (Lii) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" And Hoja1. Cells((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 10 + pos_med_col) = "" Then 'no hay ms contenido en la lnea de medicin Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp End If End If End If End If If Binsertarlineamed = True Then

Else

Medic - 10 Binsertarlineamed = False 'Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 4 + pos_med_col) = "" End If If (Lii) <> Regdis Then Else Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim(Scelda) 'HAY QUE CREAR UNA LINEA MAS Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Range("A5:L5").Copy Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim(Scelda) End If End If limpiardis volcardis ListBox1.ListIndex = Lii - 1 End Sub Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Lii As Double Dim Scelda As String Dim Dtemp As Double Dim i, j As Integer Dim Celda1, Celda4 As Range If exitleavecelldis = False Then Exit Sub Hoja1.Activate Lii = Lastrowdis + 1 Scelda = TextBox2.Text If IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "" Then exitleavecelldis = False TextBox2.Text = ListBox1.List(Lii - 1, 1) exitleavecelldis = True Exit Sub End If If Binsertarlineamed = True Then Binsertarlineamed = False If Strings.Trim(Scelda) = "" Then eliminarnuevalineamed Else Exit Sub

Else

Lii = D_linea_insert + 1 Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") End If 'Continuar como si nada

End If If (Lii) > Regdis Then Exit Sub If Strings.Trim(Scelda) = "" Then If 2 = Regdis Then ' solo esta esa linea y por su puesto no se borra If Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + pos_med_col) = "" limpiardis End If Else

If (Lii) <> Regdis Then Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + pos_med_col) = "" If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells((Lii ) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + p os_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" And Hoja1.Cell

Medic - 11

s((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 10 + pos_med_col) = "" Then Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis End If End If End If Dtemp = CDbl(TextBox2.Text) If (Lii) <> Regdis Then If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + End If Else 'HAY QUE CREAR UNA LINEA MAS Range("A5:L5").Copy Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 5 + End If

Else

pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

+ 1, 1 + pos_med_col) + 1, 12 + pos_med_col) pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

End If End If limpiardis volcardis ListBox1.ListIndex = Lii - 1 End Sub Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Lii As Double Dim Scelda As String Dim Dtemp As Double Dim i, j As Integer Dim Celda1, Celda4 As Range If exitleavecelldis = False Then Exit Sub Hoja1.Activate Lii = Lastrowdis + 1 Scelda = TextBox3.Text If IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "" Then exitleavecelldis = False TextBox3.Text = ListBox1.List(Lii - 1, 2) exitleavecelldis = True Exit Sub End If If Binsertarlineamed = True Then Binsertarlineamed = False If Strings.Trim(Scelda) = "" Then eliminarnuevalineamed Else Exit Sub

Else

Lii = D_linea_insert + 1 Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") End If 'Continuar como si nada

End If If (Lii) > Regdis Then Exit Sub If Strings.Trim(Scelda) = "" Then If 2 = Regdis Then ' solo esta esa linea y por su puesto no se borra

Medic - 12 If Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + pos_med_col) = "" limpiardis End If Else

If (Lii) <> Regdis Then Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + pos_med_col) = "" If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells((Lii ) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + p os_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" And Hoja1.Cell s((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 10 + pos_med_col) = "" Then 'no hay ms contenido en la lnea de medicin Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis End If End If End If

Else

Dtemp = CDbl(TextBox3.Text) If (Lii) <> Regdis Then If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + End If Else 'HAY QUE CREAR UNA LINEA MAS Range("A5:L5").Copy Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + End If End If End If limpiardis volcardis ListBox1.ListIndex = Lii - 1 End Sub

pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

+ 1, 1 + pos_med_col) + 1, 12 + pos_med_col) pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Lii As Double Dim Scelda As String Dim Dtemp As Double Dim i, j As Integer Dim Celda1, Celda4 As Range If exitleavecelldis = False Then Exit Sub Hoja1.Activate Lii = Lastrowdis + 1 Scelda = TextBox4.Text If IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "" Then exitleavecelldis = False TextBox4.Text = ListBox1.List(Lii - 1, 3) exitleavecelldis = True Exit Sub End If If Binsertarlineamed = True Then Binsertarlineamed = False If Strings.Trim(Scelda) = "" Then eliminarnuevalineamed Exit Sub

Medic - 13 Else Lii = D_linea_insert + 1 Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") End If 'Continuar como si nada

Else

End If If (Lii) > Regdis Then Exit Sub If Strings.Trim(Scelda) = "" Then If 2 = Regdis Then ' solo esta esa linea y por su puesto no se borra If Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" limpiardis End If Else

If (Lii) <> Regdis Then Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells((Lii ) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + p os_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" And Hoja1.Cell s((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 10 + pos_med_col) = "" Then 'no hay ms contenido en la lnea de medicin Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis End If End If End If Dtemp = CDbl(TextBox4.Text) If (Lii) <> Regdis Then If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + End If Else 'HAY QUE CREAR UNA LINEA MAS Range("A5:L5").Copy Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + End If

Else

pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

+ 1, 1 + pos_med_col) + 1, 12 + pos_med_col) pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

End If End If limpiardis volcardis ListBox1.ListIndex = Lii - 1 End Sub Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Lii As Double Dim Scelda As String Dim Dtemp As Double Dim i, j As Integer Dim Celda1, Celda4 As Range If exitleavecelldis = False Then Exit Sub Hoja1.Activate Lii = Lastrowdis + 1 Scelda = TextBox5.Text If IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "" Then

Medic - 14 exitleavecelldis = False TextBox5.Text = ListBox1.List(Lii - 1, 4) exitleavecelldis = True Exit Sub End If If Binsertarlineamed = True Then Binsertarlineamed = False If Strings.Trim(Scelda) = "" Then eliminarnuevalineamed Else Exit Sub

Else

Lii = D_linea_insert + 1 Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = Strings.Trim("") End If 'Continuar como si nada

End If If (Lii) > Regdis Then Exit Sub If Strings.Trim(Scelda) = "" Then If 2 = Regdis Then ' solo esta esa linea y por su puesto no se borra If Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" limpiardis End If Else

If (Lii) <> Regdis Then Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" If Hoja1.Cells((Lii) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells((Lii ) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 6 + p os_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 7 + pos_med_col) = "" And Hoja1.Cell s((Lii) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii) + posicionmedicion + 1, 10 + pos_med_col) = "" Then 'no hay ms contenido en la lnea de medicin Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis End If End If End If Dtemp = CDbl(TextBox5.Text) If (Lii) <> Regdis Then If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + End If Else 'HAY QUE CREAR UNA LINEA MAS Range("A5:L5").Copy Set Celda1 = Hoja1.Cells((Lii) + posicionmedicion Set Celda4 = Hoja1.Cells((Lii) + posicionmedicion Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown If Dtemp = 0 Then Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + Else Hoja1.Cells((Lii) + posicionmedicion + 1, 8 + End If

Else

pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

+ 1, 1 + pos_med_col) + 1, 12 + pos_med_col) pos_med_col) = ""

pos_med_col) = CDbl(Strings.Trim(Scelda))

End If End If limpiardis volcardis ListBox1.ListIndex = Lii - 1 End Sub Private Sub TextBox7_Change()

Medic - 15 End Sub Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Scelda As String Dim Dtemp As Double If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If Scelda = TextBox8.Text If TextBox8.Text = "0" Then TextBox8.Text = "1" End If If (IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "") Or Strings.Trim(Scelda) = "" Then Else TextBox8.Text = "1"

Dtemp = Int(TextBox8.Text) TextBox8.Text = Dtemp End If End Sub Public Sub UserForm_Activate() RemoverPasswordEnHoja exitleavecelldis = False

Regdis = 1 Binsertarlineamed = False ListBox1.ColumnCount = 7 ListBox1.ColumnWidths = "220;70;70;70;70;70;100" List_Head_medic Lastrowdis = 2 Lastcoldis = 1 actualizar_ref_mediciones ' SE ENCARGA DE QUE LAS REFERENCIAS SE PASEN A LAS LETRAS (A LA CASILLA 1 1 LA PONE EN LA 10 MENOS EL =) limpiardis

codigotexto.Caption = Hoja4.Cells(posicionconcepto, 1) udresumen.Caption = " " & Hoja4.Cells(posicionconcepto, 2) & " " & Hoja4.Cells(posicionconcepto, 3) TextBox8.Text = "1" format_meddes = Hoja7.Range("B21") format_med = Hoja7.Range("B15") volcardis ListBox1.ListIndex = 0 'Cuadrodis.SetFocus exitleavecelldis = True End Sub Private Sub Salir_Click() Hoja1.Activate If Binsertarlineamed = True Then eliminarnuevalineamed Exit Sub End If Hoja4.Activate If Bdescomposicionmed Then 'si hay medicion descompuesta aunque sea texto

Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = CDbl(Hoja1.Cells(posicion medicion, 1 + pos_med_col))

Medic - 16 Else eliminar_medicion_desc (ipoint_med + D_Proy) Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" End If actualizar_ref_mediciones Unload Me End Sub

Mexcel - 1 Option Explicit Private Sub Calcular_Click() Hoja4.Activate 'calcular_auxiliares 'calcula los descompuestos 'Sumartodo 'si estas debajo de un subcapitulo (en las partidas) no hace nada, tienes que estar arriba Sumartodofinal volcardatos editarestado End Sub Private Sub ComboBox3_Change() Dim i As Integer If exitcombo = True Then Exit Sub Hoja7.Activate ' Hoja7.Cells(Itipo_expediente + 97, 4) = D_Proy Hoja7.Cells(Itipo_expediente + 97, 5) = Ipuntos i = ComboBox3.ListIndex Hoja4.Activate salvaultimodato Sumartodofinal Itipo_de_proyecto = i limpiar volcardatos If tipoedicion = False Then Else ListBox1.ListIndex = 1

ListBox2.ListIndex = 1 End If editarestado 'Cuadro.SetFocus End Sub Private Sub ComboBox1_Change() Dim i As Integer Dim expediente_paralelo As Boolean Dim Rdestino As Range Dim Rkey As Range Dim DDCOnceptos As Double Dim Respuesta As String expediente_paralelo = False

If exitcombo = True Then Exit Sub Hoja7.Activate Hoja7.Cells(Itipo_expediente + 97, 4) = D_Proy Hoja7.Cells(Itipo_expediente + 97, 5) = Ipuntos 'No puede existir produccion de un expediente que no esta abierto i = ComboBox1.ListIndex If Hoja7.Cells(97 + i, 2) = "" Then Respuesta = MsgBox(" Est seguro de abrir un nuevo expediente?" & vbNewLine, vbYesNo, "ATE NCIN") If Respuesta <> 6 Then exitcombo = True ComboBox1.ListIndex = Itipo_expediente exitcombo = False Exit Sub End If End If If i = 1 Or i = 3 Or i = 5 Or i = 7 Or i = 9 Or i = 11 Or i = 13 Then If Hoja7.Cells(96 + i, 2) = "" Then 'si no esta abierto el expediente principal no se puede poner producciones exitcombo = True ComboBox1.ListIndex = Itipo_expediente exitcombo = False

Mexcel - 2 Else Exit Sub 'COMO ESTA ABIERTO EL EXPEDIENTE PRINCIPAL (PONERLE PUNTERO) 'HAY QUE ABRIRLO y A CONTINUACION DUPLICARLO expediente_paralelo = True

Else

End If

End If 'SE CAMBIA DE EXPEDIENTE Hoja4.Activate salvaultimodato Sumartodofinal '************************************************************* 'ESTABLECER O REINICIALIZAR EDICION PARALELA Y OTROS COMBOS Itipo_de_proyecto = 0 'cuando se cambia el expediente el n producc/cert sera cero Itipo_expediente = i Hoja7.Range("B94") = i exitcombo = True ComboBox3.ListIndex = 0 ComboBox2.ListIndex = 0 'SE quita la edicion en PARALELO ComboBox4.ListIndex = 0 B_volcar_bis = False 'SE quita la edicion en PARALELO Itipo_expediente2 = 0 Inum_cert_paralelo = 0 Hoja7.Activate Hoja7.Range("B95") = "" Hoja4.Activate 'ComboBox1 exitcombo = False 'SE quita la edicion en PARALELO Itipo_expediente_par = 0 D_Proy_paralelo = 0 'Hoja7.Cells(97 + Itipo_expediente_par, 4) Hoja7.Range("B95") = i - 1 '******************************************************* If CDbl(Hoja7.Cells(97 + i, 2)) = 1 Then 'ya estaba activado con anterioridad carga_elnuevoestado 'pone variables de inicio de expediente como "Dproy" e "Ipuntos" Base = 0 Else Hoja7.Cells(97 + i, 2) = 1 Insertar_expediente 'da direccion para punteros If expediente_paralelo = True Then Hoja4.Activate 'una vez dado el puntero hay que copiar la informacin Set Rkey = Hoja4.Cells(Hoja7.Cells(96 + i, 4) + 1, 1) Rkey.Select DDCOnceptos = Hoja7.Cells(96 + i, 5) Set Rdestino = Hoja4.Cells(Hoja7.Cells(97 + i, 4) + 1, 1) Range(ActiveCell, ActiveCell.Offset(DDCOnceptos, 7)).Copy Range(Rdestino, Rdestino) 'Range(ActiveCell, ActiveCell.Offset(DDCOnceptos, 255)).Cut Range(Rdestino, Rdestino) End If carga_elnuevoestado 'pone variables de inicio de expediente como "Dproy" e "Ipuntos" End If limpiar volcardatos If tipoedicion = False Then ListBox1.ListIndex = 1 Else ListBox2.ListIndex = 1 End If editarestado 'Cuadro.SetFocus End Sub Private Sub ComboBox2_Change() Dim i As Integer Dim j As Integer

Mexcel - 3 Dim k As Integer Dim l As Integer

If exitcombo = True Then Exit Sub Hoja7.Activate Inum_cert_paralelo = 0 'indica que numero de certificacion o produccion tiene en la edicion par aleleo i = ComboBox2.ListIndex j = ComboBox1.ListIndex If 0 = i Then 'RETIRAR LA EDICION PARALELA Edittotalimporte.Caption = "" exitcombo = True ComboBox2.ListIndex = 0 ComboBox4.ListIndex = 0 B_volcar_bis = False 'QUITAR EDICION EN PARALELO Itipo_expediente_par = 0 Inum_cert_paralelo = 0 D_Proy_paralelo = 0 Hoja7.Activate Hoja7.Range("B95") = "" Hoja4.Activate 'ComboBox1 exitcombo = False 'carga_elnuevoestado limpiar volcardatos ListBox1.ListIndex = 1 If tipoedicion = False Then ListBox1.ListIndex = 1 Else ListBox2.ListIndex = 1 End If editarestado Exit Sub ElseIf (i - 1) = j Then 'i = i - 1 'Permitido 'En el paralelo esta abierto el mismo expediente B_volcar_bis = True ElseIf Hoja7.Cells(97 + (i - 1), 2) = "" Then 'SI NO ESTA ACTIVADO EL EXPEDIENTE FUERA exitcombo = True ComboBox2.ListIndex = Itipo_expediente_par + 1 'dejarlo como antes exitcombo = False B_volcar_bis = False Exit Sub ElseIf i = 14 Or i = 15 Or i = 16 Or i = 17 Or i = 18 Then 'no se permite la edicin en paralelo de los 5 estudios exitcombo = True ComboBox2.ListIndex = Itipo_expediente_par + 1 'dejarlo como antes exitcombo = False B_volcar_bis = False Exit Sub Else 'sino es el mismo expedinte tiene que ser 'produccion del expediente original o certificacion de la produccion

k = i - 1 If (k = 1 And j = 0) Or (k = 3 And j = 2) Or (k = 5 And j = 4) Or (k = 7 And j = 6) Or (k = 9 And j = 8) Or (k = 11 And j = 10) Or (k = 13 And j = 12) Then B_volcar_bis = True ElseIf (k = 0 And j = 1) Or (k = 2 And j = 3) Or (k = 4 And j = 5) Or (k = 6 And j = 7) Or (k = 8 And j = 9) Or (k = 10 And j = 11) Or (k = 12 And j = 13) Then B_volcar_bis = True Else 'no tiene edicion en paralelo luego nos marchamos exitcombo = True

Mexcel - 4 ComboBox2.ListIndex = Itipo_expediente_par + 1 'dejarlo como antes exitcombo = False B_volcar_bis = False Exit Sub End If End If Hoja7.Activate Itipo_expediente_par = i - 1 D_Proy_paralelo = Hoja7.Cells(97 + Itipo_expediente_par, 4) Hoja7.Range("B95") = i - 1 Hoja4.Activate Inum_cert_paralelo = 0 'cuando se cambia el expediente el n producc/cert sera cero exitcombo = True ComboBox4.ListIndex = 0 exitcombo = False limpiar volcardatos If tipoedicion = False Then ListBox1.ListIndex = 1 Else ListBox2.ListIndex = 1 End If editarestado End Sub Private Sub ComboBox4_Change() Dim i As Integer If exitcombo = True Then Exit Sub If 0 = ComboBox2.ListIndex Then 'no hay edicin paralela ComboBox4.ListIndex = 0 Exit Sub End If Hoja7.Activate i = ComboBox4.ListIndex Hoja4.Activate salvaultimodato Sumartodofinal Inum_cert_paralelo = i 'cuando se cambia el expediente el n producc/cert sera cero limpiar volcardatos If tipoedicion = False Then Else ListBox1.ListIndex = 1

ListBox2.ListIndex = 1 End If editarestado End Sub Private Sub CommandButton4_Click() salvaultimodato Edicion.Show End Sub Private Sub CommandButton5_Click() 'gravar ActiveWorkbook.Save

Mexcel - 5 End Sub Private Sub Configur_Click() 'salvaultimodato Sumartodofinal Hoja7.Activate Hoja7.Range("C27") = "ac" Hoja7.Range("B26") = Base Hoja7.Range("C26") = Sposicion Hoja4.Activate config.Show editarestado End Sub Private Sub Copiar_Click() Dim i, Li, k As Double Dim l As Double Dim Lii As Integer Dim j As Double Dim CurrentCell As Range Dim NextCell As Range Dim Celda1 As Range Dim Celda4 As Range Dim Dtemp_1 As Integer Dim Dtemp_2 As Integer Dim Dtemp_3 As Integer inicializar_arch_temp j = 1 Li = Lastrow + 1 i = 0 If tipoedicion = False Then If Li >= Reg Or Li <= 0 Then Base_copia = 0 num_reg_copia = 0 Exit Sub End If 'DETERMINAR EL NUMERO DE FILAS QUE EXISTEN EN REALIDAD For l = 1 To Ipuntos

If ((99 - Li) > (Hoja4.Cells(l + D_Proy, 1) - (Base + Li))) And ((Hoja4.Cells(l + D_Proy, 1 ) - (Base + Li))) >= 0 Then i = i + 1 End If Next l If j > i Then num_reg_copia = i Else num_reg_copia = j End If Base_copia = (Base + Li - 1) '****************************************************************************** '* AHORA SE COPIA LAS MEDICIONES '* SE COPIAN PORQUE MIENTRAS SE CARGAN EN EL BUFFER, LAS MEDICIONES SE PUEDEN ALTERAR '* SI ESTAN EN EL BUFFER NO SE ALTERAN '* SE COPIAN LAS MEDICIONES QUE ESTAN EN LOS CONCEPTOS '* SE BORRA EL BUFFER DE MEDICIONES Hoja1.Activate 'Range("IG1:IV60000").Select 'Selection.ClearContents Range("IG1:IV60000").ClearContents Hoja1.Cells(1, 242) = 2 'INDICA QUE A PARTIR DE LA FILA 2 SE COPIARAN LOS DATOS 'Hoja8.Cells(1, 242).FormulaLocal = "=MAX(IG2:IH64926)"

Mexcel - 6

'Hoja8.Cells(3, 242).FormulaLocal = "=FILA(IG2)" 'PUNTERO A PARTIR DEL CUAL SE COLOCAN LAS MEDI CIONES DESCOMPUESTAS 'For l = 1 To num_reg_copia 'A CONTINUACION LLAMAMOS A LA FUNCION QUE PEGA LO QUE QUEREMOS EN LA HOJA TEMP copiar_conceptos (Li) 'Next l ' AHORA LAS MEDICIONES DESCOMPUESTAS 'Hoja1.Activate 'Hoja1.Cells(1, 242).FormulaLocal = "=MAX(IH2:IH64926)"

'actualizar_ref_mediciones 'VERIFICA QUE LAS REFERENCIAS SON CORRECTAS - PASA LA COL 11 A LA 10 MENOS EL = - LA COL 11 SIEMPRE ESTA REFERENCIADA Y NO SE PIERDE. PERO AL HACER COPIA ES NECESARIO QUE LA 10 ESTE CORRECTA 'Set Celda1 = Hoja1.Cells(8, 1 + pos_med_col) 'Dtemp_1 = CDbl(Hoja1.Cells(1, 2)) 'Dtemp_3 = CDbl(Hoja1.Cells(Dtemp_1, 3)) 'If Dtemp_3 = 0 Then Dtemp_3 = 1 'Dtemp_2 = CDbl(Hoja1.Cells(1, 2)) + 2 + Dtemp_3 + 2 'Set Celda4 = Hoja1.Cells(Dtemp_2, 12 + pos_med_col) 'Hoja1.Range(Celda1, Celda4).Select 'Selection.Copy 'Hoja8.Activate 'Range("IG8").Select 'ActiveSheet.Paste 'Hoja8.Cells(1, 242).FormulaLocal = "=MAX(IH2:IH64926)" Else 'estamos en la funcion descompuestos 'j = Mexcel.Cuadro.Selection.Rows.Count 'Li = Mexcel.Cuadro.ActiveCell.Row - 1 'If (Li) >= Regcostes Then If (Li + 1) >= Regcostes Or Li <= 0 Then Base_copia = 0 num_reg_copia = 0 'Mexcel.codigo.Caption = " " & Strings.Trim(Base_copia) 'Mexcel.resumen.Caption = " " & Strings.Trim(num_reg_copia) 'Cuadro.SetFocus Exit Sub End If i = Li k = 0 Do While Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4) <> "" i = i + 1 k = k + 1 Loop If j > k Then num_reg_copia = k Else num_reg_copia = j End If Hoja8.Activate j = 0 i = Li Do While (j + 1) <= num_reg_copia Hoja8.Cells(1, 18 + 3 * j) = Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4) Hoja8.Cells(1, 18 + 3 * j + 1) = Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4 + 1) Hoja8.Cells(1, 18 + 3 * j + 2) = Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4 + 2) i = i + 1 j = j + 1

Loop

End If Hoja4.Activate End Sub

Mexcel - 7

Private Sub ListBox1_Click() Dim i As Integer i = ListBox1.ListIndex 'Lastcolconcepto = 1 'EventInfo.Range.Column 'Lastrowconcepto = i 'EventInfo.Range.Row Lastcol = 1 Lastrow = i TextBox1.Text = ListBox1.List(i, 2) TextBox2.Text = ListBox1.List(i, 3) TextBox3.Text = ListBox1.List(i, 4) Laststring = TextBox1.Text TextBox4.Text = ListBox1.List(i, 5) TextBox5.Text = ListBox1.List(i, 6) Label5.Caption = ListBox1.List(i, 7) 'TextBox7.Text = ListBox1.List(i, 8) Label7.Caption = ListBox1.List(i, 8) 'TextBox9.Text = ListBox1.List(i, 9) Label8.Caption = ListBox1.List(i, 9) Label6.Caption = ListBox1.List(i, 10) 'TextBox10.Text = ListBox1.List(i, 11) End Sub Private Sub ListBox2_Click() Dim i As Integer i = ListBox2.ListIndex 'Lastcolconcepto = 1 'EventInfo.Range.Column 'Lastrowconcepto = i 'EventInfo.Range.Row Lastcol = 1 Lastrow = i TextBox1.Text = ListBox2.List(i, 2) TextBox2.Text = ListBox2.List(i, 3) TextBox3.Text = ListBox2.List(i, 4) Laststring = TextBox1.Text TextBox4.Text = ListBox2.List(i, 5) TextBox5.Text = ListBox2.List(i, 6) Label5.Caption = ListBox2.List(i, 7) Label7.Caption = "" Label8.Caption = "" Label6.Caption = "" End Sub Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim i As Integer Hoja4.Activate bajarenarbol Sposicion = Base + 1 Sumartodo volcardatos If tipoedicion = False Then ListBox1.ListIndex = 0 Else ListBox2.ListIndex = 0 End If editarestado End Sub Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim i As Integer

Mexcel - 8

Hoja4.Activate 'salvaultimodato bajarenarbol volcardatos If tipoedicion = False Then ListBox1.ListIndex = 0 Else ListBox2.ListIndex = 0 End If editarestado End Sub Private Sub ListBox3_Click() Dim i As Integer Hoja4.Activate 'salvaultimodato subirenarbol If tipoedicion = False Then Sposicion = Base + 1 limpiar Sumartodo volcardatos ListBox1.ListIndex = 0

Else

volcardatos ListBox2.ListIndex = 0 End If ListBox3.ListIndex = -1 editarestado End Sub Private Sub Medicin_Click() Dim Respuesta As Integer 'Dim i As Double Dim Li, i, ipoint As Double Hoja4.Activate If tipoedicion Then Exit Sub If Laststring = "" Then Exit Sub Li = Lastrow + 1 If Li >= Reg Then Exit Sub Sposicion = Base + Li ' For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = (Base + Li) Then ipoint = i Exit For End If Next i For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then posicionconcepto = i + ipuntero + 1 Exit For End If Next i If posicionconcepto = 0 Then Respuesta = MsgBox(" No es un concepto!", vbYes, "ATENCIN")

Mexcel - 9 Else

If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" And Hoja4.Cells(i + ipuntero + 1, 4) <> "%" And Hoja 4.Cells(i + ipuntero + 1, 4) <> "rd" Then filamedicion = Li ipoint_med = ipoint Hoja7.Activate Hoja7.Range("C27") = "ac" Hoja7.Range("B26") = Base Hoja7.Range("C26") = Sposicion Hoja4.Activate crearenlacemedicion End If End If End Sub Private Sub descompuestos() Dim Respuesta As Integer Dim Li, i, ipoint As Double salvaultimodato Li = Lastrow - 1 If Li > Reg Then Exit Sub If Laststring = "" Then Exit Sub filaconcepto = Li posicionconcepto = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = Sposicion Then ipoint = i Exit For End If Next i If ipoint = 0 Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then posicionconcepto = i + ipuntero + 1 Exit For End If Next i If posicionconcepto = 0 Then Respuesta = MsgBox(" No es un concepto!", vbYes, "ATENCIN") Else If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" Then Hoja7.Activate Hoja7.Range("C27") = "ac" Hoja7.Range("B26") = Base Hoja7.Range("C26") = Sposicion Hoja4.Activate Costes.Show limpiar Mexcel.UserForm_Activate editarestado End If End If Hoja4.Activate Cuadro.SetFocus End Sub Private Sub Abajo_Click() Hoja4.Activate bajarenarbol

Mexcel - 10 Sposicion = Base + 1 Sumartodo limpiar volcardatos If tipoedicion = False Then ListBox1.ListIndex = 0 Else ListBox2.ListIndex = 0 End If editarestado End Sub Private Sub Arriba_Click() Hoja4.Activate subirenarbol If tipoedicion = False Then Sposicion = Base + 1 limpiar Sumartodo volcardatos ListBox1.ListIndex = 0

Else

volcardatos ListBox2.ListIndex = 0 End If editarestado End Sub

Private Sub Cuadricula_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single , ByVal y As Single) Dim Li As Integer Hoja4.Activate If Button = 2 Then Li = Mexcel.Cuadricula.Row Sposicion = Base + Li Arriba_Click Else Li = Mexcel.Cuadricula.Row Sposicion = Base + Li

If Cuadricula.Row <> 1 And Cuadricula.ColSel = 14 And Cuadricula.col = 1 And Cuadricula.Row < R eg Then Delete.Enabled = True Insert.Enabled = True Else Delete.Enabled = False Insert.Enabled = False

End If End If End Sub Private Sub Eliminar_Click() Dim Lii As Integer Dim i As Integer, ipoint As Double Dim Respuesta As Integer Dim Celda1, Celda4 As Range Hoja4.Activate Lii = Lastrow + 1

Mexcel - 11 If tipoedicion = False Then 'estamos en jerarquia de proyectos Sposicion = Base + Lii If Laststring = "" Then Exit Sub If Lii >= Reg Then Exit Sub ipoint = 0

For i = 1 To Ipuntos

If Hoja4.Cells(i + D_Proy, 1) = Sposicion Then ipoint = i Exit For End If Next i If ipoint > Ipuntos Or ipoint = 0 Then Exit Sub If tieneproduccion(ipoint + D_Proy) Then Respuesta = MsgBox(" Est seguro de borrarlo?" & vbNewLine & " tiene producciones o certificaciones" & vbNewLine & " Perder las mediciones" & vbNewLine & " y la descomp osicin de la medicin!!!", vbYesNo, "ATENCIN") If Respuesta = 6 Then 'se elimina medicin descompuesta en caso de que tenga Exit Sub End If eliminar_todaslas_medicion_desc (ipoint + D_Proy) End If '* If trabajo_en_paralelo Then 'crearhueco_bis Rows(ipoint + D_Proy).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown Ipuntos = Ipuntos - 1 Rows(ipoint + D_Proy_bis).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy_bis)).Insert Shift:=xlDown borrarreferencias_bis i = Lii nuevareferencia_bis i Else 'crearhueco 'Rows(ipoint + D_Proy).Select 'Selection.Delete Shift:=xlUp Rows(ipoint + D_Proy).Delete Shift:=xlUp 'Hoja7.Cells(Itipo_expediente + 97, 5) = Ipuntos 'Rows((ipuntero - 2)).Insert Shift:=xlDown Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown Ipuntos = Ipuntos - 1 borrarreferencias i = Lii nuevareferencia i End If limpiar volcardatos ListBox1.ListIndex = 0 Else Else

'estamos en el editor de descompuestos If (Lii + 1) >= Regcostes Or Lii <= 0 Then

Exit Sub End If Set Celda1 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Set Celda4 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 3) Hoja4.Range(Celda1, Celda4).Delete Shift:=xlToLeft 'exitleavecell = True limpiar volcardatos ListBox2.ListIndex = 0 End If

Mexcel - 12 'Cuadro.SetFocus End Sub

Private Sub Insertar_Click() 'Dim i As Integer Lastrow = ListBox1.ListIndex If tipoedicion = False Then If trabajo_en_paralelo Then crearhueco_bis Else crearhueco End If Sposicion = Base + 1 limpiar volcardatos ListBox1.ListIndex = Lastrow crearhueco_aux volcardatos End If End Sub Private Sub Pegar_Click() Dim Li As Integer Dim Ipuntosacopiar As Integer Dim i, l As Double Dim j As Double Dim Dtemp_1 As Integer Dim Dtemp_2 As Integer Dim Dtemp_3 As Integer Dim Celda1 As Range Dim Celda4 As Range Li = Lastrow + 1 If num_reg_copia = 0 Then Exit Sub Hoja8.Select Set Celda1 = Hoja8.Cells(1, 1) Celda1.Select If IsEmpty(Celda1.Value) Then Ipuntosacopiar = 0 Else Ipuntosacopiar = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If Hoja4.Select If tipoedicion = False Then If Li > Reg Or Li <= 0 Then Exit Sub 'se coge la fila a partir de que la medicion auxiliar existe If trabajo_en_paralelo Then 'Rows((Ipuntos + 2 + D_Proy_bis)).Insert Shift:=xlDown 'borrarreferencias_bis Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row If Li = Reg Then 'pegar_conceptos 1, Li For i = 1 To num_reg_copia 'pegar_conceptos i, (Li + i - 1)

Else

Mexcel - 13 pegar_conceptos_bis i, (Li + i - 1) Next i j = Li For i = 1 To num_reg_copia 'crearhueco_pegar (j) crearhueco_pegar_bis (j) 'pegar_conceptos i, (Li + i - 1) pegar_conceptos_bis i, (Li + i - 1) j = j + 1 Next i Else End If Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row If Li = Reg Then 'pegar_conceptos 1, Li For i = 1 To num_reg_copia pegar_conceptos i, (Li + i - 1), Ipuntosacopiar Next i Else j = Li For i = 1 To num_reg_copia crearhueco_pegar (j) pegar_conceptos i, (Li + i - 1), Ipuntosacopiar j = j + 1 Next i End If End If referenciar 'esta funcion sirve para que las referencias y las formulas dentro de la medicion descompuesta estn coordinadas actualizar_ref_mediciones_alreves (Dtemp_2) volcardatos Else 'Cuadro.SetFocus If (Li + 1) > Regcostes Or Li <= 0 Then Exit Sub 'If Li > Regcostes Or Li <= 0 Then Exit Sub i = Li j = 0 Do While (j + 1) <= num_reg_copia Hoja8.Activate Set Celda1 = Hoja8.Cells(1, 18 + 3 * j) Set Celda4 = Hoja8.Cells(1, 18 + 3 * j + 3) 'Hoja8.Range(Celda1, Celda4).Select 'Selection.Copy Hoja8.Range(Celda1, Celda4).Copy Hoja4.Activate 'Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4).Select 'Selection.Insert Shift:=xlToRight Hoja4.Cells(posicionconcepto, 100 + (i - 1) * 4).Insert Shift:=xlToRight i = i + 1 j = j + 1

Else

Loop volcardatos

'Cuadro.SetFocus End If End Sub

Mexcel - 14 Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Scelda As String Dim Li As Integer If exitleavecell = False Then Exit Sub Hoja4.Activate Li = Lastrow j = Li If tipoedicion = False Then Sposicion = Base + Li + 1 ' - 1 Scelda = TextBox1.Text If (Strings.Trim(Laststring) = Strings.Trim(Scelda) And Binsertarlinea = False) Then Exit Sub If Li + 1 > Reg Then exitleavecell = False TextBox1.Text = ListBox1.List(Li, 2) exitleavecell = True Exit Sub End If entradacodigo Li, 3, Scelda limpiar volcardatos ListBox1.ListIndex = j If (Li) >= Regcostes Then exitleavecell = False TextBox1.Text = ListBox1.List(Li, 2) exitleavecell = True Exit Sub End If Scelda = TextBox1.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub entradacodigo_aux Li, 3, Scelda limpiar volcardatos ListBox2.ListIndex = j End If End Sub Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Scelda As String Dim Li As Integer If exitleavecell = False Then Exit Sub Hoja4.Activate Li = Lastrow j = Li If tipoedicion = False Then Sposicion = Base + Li + 1 ' - 1 Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox2.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox2.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub If Li + 1 >= Reg Then exitleavecell = False TextBox2.Text = ListBox1.List(Li, 3)

Else

Mexcel - 15 exitleavecell = True Exit Sub End If If (IsNumeric(Scelda) = False Or (Scelda = "")) Then entradaunidad Li, 3, Scelda End If limpiar volcardatos ListBox1.ListIndex = j Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox2.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox2.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub If (IsNumeric(Scelda) Or (Scelda = "")) = False Then entradaunidad_aux Li, Scelda End If limpiar volcardatos ListBox2.ListIndex = j

Else

End If End Sub Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Scelda As String Dim Li As Integer If exitleavecell = False Then Exit Sub Hoja4.Activate Li = Lastrow j = Li If tipoedicion = False Then Sposicion = Base + Li + 1 ' - 1 Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox3.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox3.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub If Li + 1 >= Reg Then exitleavecell = False TextBox3.Text = ListBox1.List(Li, 4) exitleavecell = True Exit Sub End If entradaresumen Li, 3, Scelda limpiar volcardatos ListBox1.ListIndex = j Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox3.Text = "" exitleavecell = True

Else

Mexcel - 16 Exit Sub End If Scelda = TextBox3.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub entradaresumen_aux Li, Scelda limpiar volcardatos ListBox2.ListIndex = j End If End Sub Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Scelda As String Dim Li As Integer If exitleavecell = False Then Exit Sub Hoja4.Activate Li = Lastrow j = Li If tipoedicion = False Then Sposicion = Base + Li + 1 ' - 1 Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox4.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox4.Text If Strings.Trim(ListBox1.List(Lastrow, 5)) = Strings.Trim(Scelda) Then Exit Sub If Li + 1 >= Reg Then exitleavecell = False TextBox4.Text = ListBox1.List(Li, 5) exitleavecell = True Exit Sub End If If (IsNumeric(Scelda) Or (Scelda = "")) Then entradamedicion Scelda End If limpiar volcardatos ListBox1.ListIndex = j Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox4.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox4.Text If Strings.Trim(ListBox2.List(Lastrow, 5)) = Strings.Trim(Scelda) Then Exit Sub If (IsNumeric(Scelda) Or (Scelda = "")) Then entradarendimiento Li, Scelda End If limpiar volcardatos ListBox2.ListIndex = j End If End Sub

Else

Mexcel - 17 Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim i, j As Double Dim Scelda As String Dim Li As Integer If exitleavecell = False Then Exit Sub Hoja4.Activate Li = Lastrow j = Li If tipoedicion = False Then Sposicion = Base + Li + 1 ' - 1 Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox5.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox5.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub If Li + 1 >= Reg Then exitleavecell = False TextBox5.Text = ListBox1.List(Li, 6) exitleavecell = True Exit Sub End If If (IsNumeric(Scelda) Or (Scelda = "")) Then entradaprecioejec Li, 3, Scelda End If limpiar volcardatos ListBox1.ListIndex = j Scelda = TextBox1.Text 'VER SI EXISTE CODIGO DE PARTIDA If Strings.Trim(Scelda) = "" Then exitleavecell = False TextBox5.Text = "" exitleavecell = True Exit Sub End If Scelda = TextBox5.Text If Strings.Trim(Laststring) = Strings.Trim(Scelda) Then Exit Sub If (IsNumeric(Scelda) Or (Scelda = "")) Then entradaprecioejec_aux Li, Scelda End If limpiar volcardatos ListBox2.ListIndex = j End If End Sub Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim Scelda As String Dim Dtemp As Double Scelda = TextBox8.Text If TextBox8.Text = "0" Then TextBox8.Text = "1" End If If (IsNumeric(Scelda) = False And Strings.Trim(Scelda) <> "") Or Strings.Trim(Scelda) = "" Then TextBox8.Text = "1"

Else

Mexcel - 18 Else Dtemp = Int(TextBox8.Text) TextBox8.Text = Dtemp End If End Sub Public Sub UserForm_Activate() Application.ScreenUpdating = False Application.Calculation = xlAutomatic exitleavecell = False RemoverPasswordEnHoja Reg = 1 tipoedicion = False Base = 0 Sposicion = 0 Binsertarlinea = True ipuntero = Hoja7.Range("B23") ListBox1.ColumnCount = 11 ListBox1.ColumnWidths = "25;20;80;30;180;76;76;76;76;76;76" List_Head1 ListBox2.ColumnCount = 8 ListBox2.ColumnWidths = "20;20;80;30;180;76;76;76" Lastrow = 1 Lastcol = 1 Existvalue = "" Binsertarlinea = False IConceptos = 0 Ipuntos = 0 Hoja7.Activate Hoja7.Range("C27") = "ac" Hoja4.Activate

carga_estado GetStart 'fijar_base_concepto referenciar editarestado If calculocontinuo Then Sumartodo 'solo se hace comprobacion de suma en caso de que este autorizada la suma automatica 'esto evita que se pase por Sumartodo y que se de a la funcion informacin antes de volcardatos --> lo que podra incurrir en la entrega de datos erroneos volcardatos If tipoedicion = False Then ListBox2.Visible = False ListBox1.Visible = True 'ListBox2.Enabled = True Else ListBox1.Visible = False ListBox2.Visible = True End If ListBox1.ListIndex = 0 exitleavecell = True Hoja4.Activate End Sub Private Sub GetStart() Dim j As Integer Dim format(0 To 4) As String Dim stemp1 As String

Mexcel - 19 Dim Stemp2 As String Dim stemp3 As String

Hoja4.Activate nuevo 'Filtromaq = "maq" 'Filtroman = "mo" 'Filtromat = "mat" 'Filtrosub = "sub" Filtrocap = Strings.Trim(Hoja7.Cells(9, 2)) Filtrocap2 = Filtrocap Filtroaux = "%" Filtromaq = Strings.Trim(Hoja7.Cells(13, 2)) Filtroman = Strings.Trim(Hoja7.Cells(11, 2)) Filtromat = Strings.Trim(Hoja7.Cells(12, 2)) Filtrosub = Strings.Trim(Hoja7.Cells(14, 2)) 'FUNCION ESTADO inicializar_arch_temp 'prepara y vacia la hoja temporal para copias 'verificar_med_descompuestas 'estudia que no se quede colgada ninguna medicin descompuesta format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

exitleavecell = False exitleavecell = True TextBox8.Text = "1" End Sub Private Sub Salir_Click() Base = 0 Sumartodofinal Estado_final 'Determina la base de datos del Proyecto en la hoja4, la distribulle y organiza Hoja4.Cells(ipuntero + 1, 1) = "##" ponerPasswordEnHoja End End Sub Private Sub TexTo_Click() Dim Respuesta As Integer Dim Li As Integer Dim i As Double 'Dim j As Double Dim temp Hoja4.Activate If tipoedicion = False Then 'estamos en jerarquia de proyectos If Laststring = "" Then Exit Sub Li = Lastrow + 1 If Li >= Reg Then Exit Sub 'j = Li - 1 Sposicion = Base + Li '

Mexcel - 20 filaconcepto = Li ' - 1 posicionconcepto = 0 For i = 1 To IConceptos temp = Hoja4.Cells(i + ipuntero + 1, 1) If IsNumeric(temp) Then If Hoja4.Cells(i + ipuntero + 1, 1) = Val(Laststring) Then posicionconcepto = i + ipuntero + 1 Exit For End If Else If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Laststring) Then posicionconcepto = i + ipuntero + 1 Exit For End If End If Next i If posicionconcepto = 0 Then Respuesta = MsgBox(" No es un concepto!", vbYes, "ATENCIN") Else Hoja7.Activate Hoja7.Range("C27") = "ac" Cuadrotexto.Show Hoja7.Range("B26") = Base Hoja7.Range("C26") = Sposicion Hoja4.Activate End If Else End If limpiar volcardatos ListBox1.ListIndex = 0 End Sub Private Sub Valorada_Click() Hoja4.Activate presentarproyecto End Sub Private Sub Conceptos_Click() 'salvaultimodato Hoja7.Activate Hoja7.Range("C27") = "ac" Hoja7.Range("B26") = Base Hoja7.Range("C26") = Sposicion 'Hoja7.Range("B26") = Base 'Hoja7.Range("C26") = Sposicion 'Hoja7.Range("C27") = Sposicion Hoja4.Activate CConceptos.Show editarestado Hoja4.Activate 'Cuadro.SetFocus limpiar

Mexcel - 21 volcardatos GetStart editarestado End Sub Private Sub carga_estado() Dim i, j As Double Dim Rkey As Range Dim Respuesta As Integer '********************************************************************************* '* '* 1.-CARGA LAS COMBO PARA LA EDICION DE LOS TRABAJOS '* '********************************************************************************* For i = 0 To 18 ComboBox1.AddItem Hoja7.Cells(97 + i, 1) Next i ComboBox2.AddItem "vacio" For i = 0 To 18 ComboBox2.AddItem Hoja7.Cells(97 + i, 1) Next i For i = 0 To 80 ComboBox3.AddItem Strings.Trim(i) Next i For i = 0 To 80 ComboBox4.AddItem Strings.Trim(i) Next i '********************************************************************************* '* '* 2.-CARGA LAS VARIABLES MAS IMPORTANTES DE TRABAJO '* '********************************************************************************* Hoja7.Activate Hoja7.Cells(97, 2) = 1 'SIEMPRE EN UNO COMO DEFECTO 'Hoja7.Cells(95, 2) = "" 'se empieza sin edicion en paralelo

exitcombo = True ComboBox1.ListIndex = 0 ComboBox2.ListIndex = 0 ComboBox3.ListIndex = 0 ComboBox4.ListIndex = 0 'D_Proy =Hoja7.Cells(97, 4) '********************************************************************************* '* '* 3.-CARGA DATOS DEL EXPEDIENTE EN EDICION PRINCIPAL (si tiene produccion y certificacion activado s) '* '********************************************************************************* If Hoja7.Range("B94").Value <> "" Then Itipo_expediente = Hoja7.Range("B94") Itipo_de_proyecto = 0 ' indica que numero de certificacion o produccion tiene ComboBox1.ListIndex = Itipo_expediente D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) Else Itipo_expediente = 0 'quiere decir que esta vacio ComboBox1.ListIndex = 0 Hoja7.Range("B94").Value = 0

End If 'ver si hay archivo de produccion y certificacion abierto a la vez trabajo_en_paralelo = False i = Itipo_expediente If i = 0 Or i = 2 Or i = 4 Or i = 6 Or i = 8 Or i = 10 Or i = 12 Then If Hoja7.Cells(97 + i + 1, 2) = "1" Then trabajo_en_paralelo = True Itipo_expediente2 = i + 1

Mexcel - 22 D_Proy_bis = Hoja7.Cells(97 + i + 1, 4) Else End If ElseIf i = 1 Or i = 3 Or i = 5 Or i = 7 Or i = 9 Or i = 11 Or i = 13 Then If Hoja7.Cells(97 + i - 1, 2) = "1" Then trabajo_en_paralelo = True 'INDICA QUE LA PRODUCCION Y LA CERTIFICACION ESTAN ACTIVADAS Itipo_expediente2 = i - 1 D_Proy_bis = Hoja7.Cells(97 + i - 1, 4) Else End If ElseIf i = 14 Or i = 15 Or i = 16 Or i = 17 Or i = 18 Then trabajo_en_paralelo = False End If '********************************************************************************* '* '* 4.-ESTUDIA SI HAY EDICION DOBLE O PARALELA '* '*********************************************************************************

If Hoja7.Range("B95").Value <> "" Then Itipo_expediente_par = Hoja7.Range("B95") ComboBox2.ListIndex = CDbl(Hoja7.Range("B95")) + 1 D_Proy_paralelo = Hoja7.Cells(97 + Itipo_expediente_par, 4) Inum_cert_paralelo = 0 'indica que numero de certificacion o produccion tiene en la edicion paraleleo B_volcar_bis = True Else 'si esta vacio no hay edicion del presupuesto paralelo Edittotalimporte.Caption = "" Itipo_expediente_par = 0 'quiere decir que esta vacio Inum_cert_paralelo = 0 'indica que numero de certificacion o produccion tiene en la edicion paraleleo Hoja7.Range("B95").Value = 0 ComboBox2.ListIndex = 0 B_volcar_bis = False 'quiere decir que esta vacio End If exitcombo = False '********************************************************************************* '* '* 5.-DETERMINA NUMERO DE CONCEPTOS Y LOS ORDENA '* '********************************************************************************* Hoja4.Activate '* Hoja4.Activate referenciar Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ordenarpresupuesto ordenarconcepto If Ipuntos > 500 And Hoja7.Cells(28, 2) = True Then Respuesta = MsgBox(" El Proyecto supera las 500 partidas. ble detener el clculo automtico. ", vbYesNo, "ATENCIN") Hoja7.Activate If Respuesta = 6 Then

" & vbNewLine & " Es recomenda

CIN")

Hoja7.Cells(29, 2) = False calculocontinuo = False If Hoja7.Cells(28, 2) = True Then Respuesta = MsgBox(" Quiere que vuelva a aparecer este cuadro ? ", vbYesNo, "ATEN If Respuesta <> 6 Then Hoja7.Cells(28, 2) = False

Mexcel - 23 Hoja7.Cells(28, 2) = True End If End If Hoja4.Activate Hoja7.Cells(29, 2) = True calculocontinuo = True Else

Else

End If ElseIf Ipuntos > 500 Then calculocontinuo = Hoja7.Cells(29, 2) Else calculocontinuo = True Hoja7.Cells(29, 2) = True End If If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vigor) End If

'actualizar_ref_mediciones 'actualizar_ref_mediciones 'VERIFICA QUE LAS REFERENCIAS SON CORRECTAS - PASA LA COL 11 A LA 10 MEN OS EL = - LA COL 11 SIEMPRE ESTA REFERENCIADA Y NO SE PIERDE. PERO AL HACER COPIA ES NECESARIO QUE LA 10 ESTE CORRECTA 'tambien se pasa el contenido de la 2 a la 1 'actualizavariablesmesobrayedicion End Sub Private Sub carga_elnuevoestado() 'se encarga de actualizar las variables de puntero de proyecto y n conceptos (no cambia) Dim Rkey As Range Dim Respuesta As Integer Dim i As Integer D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) 'ver si hay archivo de produccion y certificacion abierto a la vez trabajo_en_paralelo = False i = Itipo_expediente If i = 0 Or i = 2 Or i = 4 Or i = 6 Or i = 8 Or i = 10 Or i = 12 Then If Hoja7.Cells(97 + i + 1, 2) = "1" Then trabajo_en_paralelo = True Itipo_expediente2 = i + 1 D_Proy_bis = Hoja7.Cells(97 + i + 1, 4) Else End If ElseIf i = 1 Or i = 3 Or i = 5 Or i = 7 Or i = 9 Or i = 11 Or i = 13 Then If Hoja7.Cells(97 + i - 1, 2) = "1" Then trabajo_en_paralelo = True Itipo_expediente2 = i - 1 D_Proy_bis = Hoja7.Cells(97 + i - 1, 4) Else End If ElseIf i = 14 Or i = 15 Or i = 16 Or i = 17 Or i = 18 Then trabajo_en_paralelo = False End If Hoja4.Activate referenciar Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If

Mexcel - 24 ordenarpresupuesto '************************************************************************************** ' DETERMINACION DE CALCULO AUTOMATICO O NO Hoja7.Activate Hoja7.Cells(28, 2) = True 'ACTIVAR EL CUADRO DE AVISO If Ipuntos > 500 And Hoja7.Cells(28, 2) = True Then Respuesta = MsgBox(" El Proyecto supera las 500 partidas. ble detener el clculo automtico. ", vbYesNo, "ATENCIN") Hoja7.Activate If Respuesta = 6 Then

" & vbNewLine & " Es recomenda

CIN")

Hoja7.Cells(29, 2) = False calculocontinuo = False If Hoja7.Cells(28, 2) = True Then Respuesta = MsgBox(" Quiere que vuelva a aparecer este cuadro ? ", vbYesNo, "ATEN If Respuesta <> 6 Then Hoja7.Cells(28, 2) = False 'true quiere decir que NO aparezca Else Hoja7.Cells(28, 2) = True End If End If Hoja4.Activate Hoja7.Cells(29, 2) = True calculocontinuo = True

Else

End If ElseIf Ipuntos > 500 Then calculocontinuo = Hoja7.Cells(29, 2) Else calculocontinuo = True Hoja7.Cells(29, 2) = True End If Hoja4.Activate End Sub

Pantallazo - 1 Option Explicit

Private Sub CommandButton3_Click() Unload Me config.Show End Sub Private Sub CommandButton4_Click() Unload Me Copseg.Show End Sub Private Sub CommandButton5_Click() Unload Me Informes.Show End Sub Private Sub Mexcels_Click() Unload Me Mexcel.Show End Sub Private Sub producc_Click() Unload Me Traduce.Show End Sub

Private Sub Sal_Click() ponerPasswordEnHoja End End Sub Public Sub UserForm_Activate() RemoverPasswordEnHoja End Sub

Traduce - 1

Private Sub Aceptar_Click() Dim i As Double Dim j As Integer Dim Respuesta As Integer Dim LeftCell As Range Dim RightCell As Range z$ = Hoja7.Range("B1")

Respuesta = MsgBox("Se perder toda la informacin del Proyecto actual" & vbNewLine & vbNewLine & " Desea continuar? ", vbYesNo, "ATENCIN") If Respuesta = 6 Then 'ipuntero = Hoja7.Range("B23") Hoja4.Activate Cells.Select Selection.ClearContents Hoja1.Activate 'SE BORRA EL BUFFER DE LINEAS DE MEDICION DESCOMPUESTA Hoja1.Range("HU3") = "" 'Hoja1.Range("HU4:IF2000").Select 'Selection.ClearContents Hoja1.Range("HU4:IF2000").ClearContents 'SE BORRA LAS MEDICIONES DESCOMPUESTAS PERTENECIENTES A LAS PARTIDAS 'Range("IG1:IV60000").Select 'Selection.ClearContents Range("IG1:IV60000").ClearContents Cells.Select Selection.ClearContents 'EMPEZAMOS A RELLENAS Hoja1.Cells(2, 4) = "TEXTO" Hoja1.Cells(2, 5) = "UD" Hoja1.Cells(2, 6) = "LONG" Hoja1.Cells(2, 7) = "ANCHO" Hoja1.Cells(2, 8) = "ALTO" Hoja1.Cells(2, 9) = "RESULTADO" Hoja1.Cells(2, 10) = "ENLACE/LINK" Hoja1.Cells(2, 11) = "TIPO FORMULA" Hoja1.Cells(2, 12) = "BUFFER" Hoja1.Cells(2, 12) = "BUFFER" Hoja1.Cells(4, Hoja1.Cells(6, Hoja1.Cells(3, Hoja1.Cells(3, Hoja1.Cells(3, 1) = "ESTA LINEA SIEMPRE VACIA" 1) = "MARCA" 1).FormulaLocal = "=SUMA(I4:I6)" 2).FormulaLocal = "=FILA(A3)" 3).FormulaLocal = "=SUMA(C4:C6)"

Hoja7.Activate '******************************************************************* 'If Checkrecur.Value = True Then Hoja7.Cells(1, 2) = "" Hoja7.Cells(2, 2) = "" Hoja7.Cells(3, 2) = 0 Hoja7.Cells(4, 2) = "" Hoja7.Cells(5, 2) = 1 Hoja7.Cells(6, 2) = "" Hoja7.Cells(6, 3) = "" 'Hoja7.Cells(6, 4) = "" Hoja7.Cells(7, 2) = "" Hoja7.Cells(8, 2) = "" For i = 9 To 24 Hoja7.Cells(i, 2) = Hoja7.Cells(i, 3)

Traduce - 2 Next i 'End If '************************************************************ Hoja7.Cells(26, 2) = "" Hoja7.Cells(26, 3) = "" Hoja7.Cells(27, 3) = "" Hoja7.Cells(28, 2) = "true" Hoja7.Cells(28, 3) = "true" Hoja7.Cells(29, 2) = "true" Hoja7.Cells(29, 3) = "true" Hoja7.Range("B6") = "" 'Hoja7.Range("C6") = "" 'Hoja7.Range("D6") = "" Hoja7.Range("B3") = "" Hoja7.Range("B37") = "" 'FECHA PROYECTO Hoja7.Range("B38") = "" Hoja7.Range("B39") = "" Hoja7.Range("B40") = "" 'ASUNTO COPIA DE SEGURIDAD i = 0 Do While IsEmpty(Hoja7.Cells(88, 2 + i)) = False Hoja7.Cells(88, 2 + i) = "" Hoja7.Cells(89, 2 + i) = "" Hoja7.Cells(90, 2 + i) = "" i = i + 1 Loop

ponerPasswordEnHoja

Hoja7.Activate Hoja7.Cells(1, 2) = z$ Proyecto.Text = Hoja7.Range("B1") Hoja2.Activate '*********************************************************************************** '* '* '* SE EMPIEZA A COLOCAR LA INFORMACION TRADUCIDA A MEXCEL '* '* '* '***********************************************************************************

If excel_amexcel = 0 Then 'se puede coger Ifili_max = 0 para retornar variable de error en la f uncion

'****************************************************************************************** *************************** 'SE COPIA LA ESTRUCTURA DE PROYECTO '****************************************************************************************** ****** 'Ipunterocodigos Hoja2.Activate Set LeftCell = Hoja2.Cells(Ipunteroestructura, 1) LeftCell.Select 'Lii_puntero_estructura Set RightCell = LeftCell.Offset(Lii_puntero_estructura, 8) ' SE POSICIONA EN EL EXTREMO 'ActiveSheet.Range(LeftCell, RightCell).Select 'Selection.Copy ActiveSheet.Range(LeftCell, RightCell).Copy Hoja4.Activate Hoja4.Cells.Range("A1").Select ActiveSheet.Paste 'Hoja4.Range("A1").Paste

Traduce - 3

'****************************************************************************************** *************************** 'AHORA LOS CONCEPTOS '****************************************************************************************** ****** Hoja2.Activate 'Ipunteroestructura = 166 'Lii_puntero_estructura = 17 Set LeftCell = Hoja2.Cells(Ipunterocodigos, 1) LeftCell.Select Set RightCell = LeftCell.Offset(Lii_puntero, 8) ' SE POSICIONA EN EL EXTREMO 'ActiveSheet.Range(LeftCell, RightCell).Select 'Selection.Copy ActiveSheet.Range(LeftCell, RightCell).Copy Hoja4.Activate Set LeftCell = Hoja4.Cells(ipuntero + 2, 1) Set RightCell = Hoja4.Cells(ipuntero + 2, 1) ActiveSheet.Range(LeftCell, RightCell).Select ActiveSheet.Paste 'ActiveSheet.Range(LeftCell, RightCell).Paste

'****************************************************************************************** *************************** 'SE LIMPIA LA HOJA DEL PRESUPUESTO EN EXCEL '****************************************************************************************** ****** Hoja2.Activate 'Columns("A:I").Select 'Selection.Delete Shift:=xlToLeft Columns("A:I").Delete Shift:=xlToLeft 'Rows("1:1").Select 'Selection.Delete Shift:=xlUp Rows("1:1").Delete Shift:=xlUp inicializar_exportacion CommandButton1.Enabled = True

Else

End If End If 'ordenarconcepto 'Sumartodo End Sub Private Sub Cancelar_Click() ponerPasswordEnHoja End End Sub Private Sub CheckBox1_Click() 'Public B_import_med As Boolean 'Public B_import_precdesc As Boolean 'Public B_ajuste_precdesc As Boolean If CheckBox1.Value = False Then B_import_med = False CheckBox1.Caption = "Las mediciones descompuestas no se importan" Else 'CheckBox1.Value = True B_import_med = True CheckBox1.Caption = "Las mediciones descompuestas se importan" End If End Sub Private Sub CheckBox2_Click()

Traduce - 4 If CheckBox2.Value = False Then B_import_precdesc = False CheckBox2.Caption = "Los precios descompuestos no se importan" Else 'CheckBox2.Value = True B_import_precdesc = True CheckBox2.Caption = "Los precios descompuestos se importan" End If End Sub Private Sub CheckBox3_Click() If CheckBox3.Value = False Then B_ajuste_precdesc = False CheckBox3.Caption = "No se ajustan los precios descompuestos al precio partida" Else 'CheckBox1.Value = True B_ajuste_precdesc = True CheckBox3.Caption = "Se ajustan los precios descompuestos al precio partida" End If End Sub Private Sub ComboBox1_Change() Dim Rkey As Range Dim i As Integer If exitcombo = True Then Exit Sub i = ComboBox1.ListIndex If Hoja7.Cells(97 + i, 2) = "" Then 'si no esta abierto el expediente principal no se puede poner producciones exitcombo = True ComboBox1.ListIndex = Itipo_expediente exitcombo = False Else 'SE CAMBIA DE EXPEDIENTE

Itipo_de_proyecto = 0 'cuando se cambia el expediente el n producc/cert sera cero Itipo_expediente = i D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If End If End Sub Private Sub CommandButton1_Click() 'inicializar_exportacion Label70.Visible = True exporta_bc3 Label70.Visible = False End Sub Private Sub CommandButton2_Click() Dim Rkey As Range 'B_import_med = False Application.ScreenUpdating = False Estado.Caption = "Borrando" A_limpiar 'funcion incluida en el modulo 3 de comenzar y sirve para limpiar todo format_import = Hoja7.Range("B17") format_med = Hoja7.Range("B15") format_prec = Hoja7.Range("B16") CONVIERTE_BC3 'en el modulo 11 calculocontinuo = True Hoja4.Activate Set Rkey = Hoja4.Cells(D_Proy + 1, 1)

Traduce - 5 Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ordenarpresupuesto ordenarconcepto referenciar Base = 0 Sumartodofinal 'MsgBox "En principio la importacin se ha realizado correctamente!!!" 'Estado.Caption = "Finalizado" End Sub

Private Sub CommandButton3_Click() Unload Me Informes.Show End Sub Private Sub CommandButton4_Click() Unload Me config.Show End Sub Private Sub Proyecto_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hoja7.Activate Hoja7.Cells(1, 2) = Strings.Trim(Proyecto.Text) Hoja2.Activate End Sub Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Tituloarchivobc3 = TextBox1.Text End Sub Public Sub UserForm_Activate() Hoja8.Activate Cells.ClearContents Proyecto.Text = Hoja7.Range("B1") carga_estado CheckBox1.Value = False CheckBox2.Value = False CheckBox3.Value = False CheckBox1_Click CheckBox2_Click CheckBox3_Click Tituloarchivobc3 = "mexcel" TextBox1.Text = Tituloarchivobc3 End Sub Private Sub carga_estado() Dim i, j As Double Dim Rkey As Range

'********************************************************************************* '* '* 1.-CARGA LAS COMBO PARA LA EDICION DE LOS TRABAJOS '* '********************************************************************************* For i = 0 To 18 ComboBox1.AddItem Hoja7.Cells(97 + i, 1) Next i

Traduce - 6

exitcombo = True ComboBox1.ListIndex = 0

'********************************************************************************* '* '* 2.-CARGA DATOS DEL EXPEDIENTE EN EDICION PRINCIPAL (si tiene produccion y certificacion activado s) '* '********************************************************************************* Itipo_expediente = 0 Itipo_de_proyecto = 0 ' indica que numero de certificacion o produccion tiene ComboBox1.ListIndex = Itipo_expediente D_Proy = Hoja7.Cells(97 + Itipo_expediente, 4) exitcombo = False '********************************************************************************* '* '* 3.-DETERMINA NUMERO DE CONCEPTOS Y LOS ORDENA '* '********************************************************************************* Hoja4.Activate Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ipuntero = Hoja7.Range("B23") ordenarconcepto

End Sub

MenuMod - 1 Option Explicit

'**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** Sub MakeMenu() ' Creates a new menu and adds menu items Dim Cap(1 To 11) Dim Mac(1 To 11) Dim NewMenu As CommandBarControl Dim Item As CommandBarControl Dim MenuCount As Integer Dim i As Integer Cap(1) = "Nuevo Proyecto" Mac(1) = "Abrircomenzar" Cap(2) = "Configurar" Mac(2) = "Abrirconfig" Cap(3) = "Editor de Proyecto" Mac(3) = "abrirmexcel" 'Cap(4) = "Costes Indirectos" 'Mac(4) = "AbrirCindirectos" 'Cap(5) = "Aprobar la viabilidad de la Obra" 'Mac(5) = "AbrirValidar" 'Cap(6) = "Produccion Mensual" 'Mac(6) = "Abrirproduccion" Cap(4) = "Importar/Exportar BC3" Mac(4) = "importarbc3" 'Cap(5) = "Exportar BC3" 'Mac(5) = "exportarbc3" 'Cap(6) = "Importar Presupuesto Excel" 'Mac(6) = "importarexcel" Cap(5) = Mac(5) = 'Cap(11) 'Mac(11) ' "Informes" "Abririnformes" = "Financieros" = "Abrirfinancieros"

Delete the menu if it already exists On Error Resume Next Application.CommandBars(1).Controls("&Proyectos").Delete On Error GoTo 0

'

Add the menu MenuCount = Application.CommandBars(1).Controls.Count Set NewMenu = Application.CommandBars(1).Controls.Add(Type:=msoControlPopup, Before:=MenuCount, temporary:=True) NewMenu.Caption = "&Proyectos"

'

Add the menu items For i = 1 To 5 Set Item = NewMenu.Controls.Add(Type:=msocontrolbutton, temporary:=True) With Item .Caption = Cap(i) .OnAction = Mac(i) If i Mod 6 = 0 Then .BeginGroup = True End With Next i End Sub Sub DeleteMenu() ' Delete the menu before closing On Error Resume Next Application.CommandBars(1).Controls("&Proyectos").Delete End Sub Public Sub abrirmexcel() Mexcel.Show End Sub

MenuMod - 2 Public Sub abriractualizar() Actualizar.Show End Sub Public Sub abrircindirectos() Cindirectos.Show End Sub Public Sub abrircomenzar() 'Nuevo proyecto Comenzar.Show End Sub Public Sub abrirconfig() config.Show End Sub Public Sub abririnformes() Informes.Show End Sub Public Sub abrirseguimiento() Seguimiento.Show End Sub Public Sub abrirproduccion() Produccion.Show End Sub Public Sub abrirfinancieros() Financieros.Show End Sub Public Sub importarbc3() Traduce.Show End Sub

Mdulo1 - 1

Option Explicit '**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '****************************************************************

Public Binsertarlinea As Boolean Public exitleavecell As Boolean Public Sposicion As Double Public posicionconcepto As Double Public Point_padre As Double 'contiene el puntero en la partida o la estructura para introducir el valor del capitulo Public DTotalimporte As Double 'contiene el importe suma de la edicion. Sirve como suma rpida para no calcular todo el presupuesto '**************************************************************** ' VARIABLES DE EDICION Public DataPres(1 To 100, 1 To 12) ' 1 VARIABLES DE TRABAJO PRINCIPAL DEL EDITOR, VARIABLES DEL EXPEDIENTE EN CURSO Public exitcombo As Boolean Public D_Proy As Double 'contiene el puntero de estructura de proyecto que indica el n_expediente Public Itipo_expediente As Integer 'Aqui esta el tipo de edicin de Proyecto=0, Mod, compl,etc Public Itipo_de_proyecto As Integer 'Aqui esta el n de certificacion, o de produccion

' 2 VARIABLES PARA EL CASO DE QUE ESTE ABIERTA LA PRODUCCION Y LA CERTIFICACION 'DE ESTA MANERA HAY EL MISMO NUMERO DE CONCEPTOS EN LOS DOS EXPEDIENTES Public trabajo_en_paralelo As Boolean 'indica que esta en paralelo y que tenemos expedientes parale los de produccion y certificacion Public D_Proy_bis As Double 'contiene el puntero de produccion o de certificacion Public Itipo_expediente2 As Integer 'en el caso de que tenga produccion y certificacion abiertos ' 3. VARIABLES DE EDICION PARALELA. CON ESTO SE TRABAJA EN LA SEGUNDA COLUMNA DEL EDITOR Public D_Proy_paralelo As Double 'contiene el puntero de edicion paralela Public B_volcar_bis As Boolean 'indica que se utilice la funcin de volcar_bis (edicion doble) Public Inum_cert_paralelo As Integer Public Itipo_expediente_par As Integer 'para el trabajo '*********************************************************************** Public Reg As Integer Public Base As Double Public Regcostes As Double Public Level As Integer Public Code(1 To 20) As String Public ipuntero As Double Public IConceptos As Integer Public Ipuntos As Double Public Base_copia As Double Public num_reg_copia As Integer Public Itipo_portapapeles As Integer

Public Lastcol As Integer, Lastrow As Integer Public Laststring As String Public Existvalue As String Public filaconcepto As Integer Public tipoedicion As Boolean Public calculocontinuo As Boolean

Public Filtrocap As String Public Filtrocap2 As String Public Filtroaux As String

Mdulo1 - 2 Public Public Public Public Public Public Public Public Public Public Public Public Filtromaq Filtroman Filtromat Filtrosub As As As As String String String String

formateje As String format_import As String format_prec As String format_med As String format_renrec As String format_precrec As String format_imprec As String format_meddes As String

Public Sub entradacodigo(ByVal Lii As Integer, ByVal Ljj As Integer, ByVal Scelda As String) Dim Li As Long ', Lj As Long Dim i As Double, ipoint As Double Dim Respuesta As Integer Dim Stemp2 As String Dim Stemp As String Scelda = Strings.Left(Scelda, 15) Lii = Lii - 1 If Strings.Trim(Scelda) = "Redondeo" Or Strings.Trim(Scelda) = "REDONDEO" Then Scelda = "&&" If car_raros(Scelda) Then limpiar Exit Sub End If ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = Sposicion Then ipoint = i + D_Proy Exit For End If Next i If ipoint <> 0 Then If Strings.Trim(Scelda) = Hoja4.Cells(ipoint, 2) Then Exit Sub End If

If Scelda = "&&" Then 'concepto de tipo redondeo Respuesta = MsgBox(" No se permiten conceptos redondeo" & vbNewLine & "que esten fuera de la descomposicin de partidas.", vbYes, "ATENCIN") Mexcel.TextBox1.Text = Laststring Exit Sub End If If (InStr(1, Scelda, "%") <> 0) Then 'Filtroaux Respuesta = MsgBox(" No se permiten Medios auxiliares" & vbNewLine & "que esten fuera de la descomposicin de partidas.", vbYes, "ATENCIN") Mexcel.TextBox1.Text = Laststring Exit Sub End If If Strings.Trim(Scelda) = "" Then If ipoint <> 0 Then If tieneproduccion(ipoint) Then Respuesta = MsgBox(" Est seguro de borrarlo?" & vbNewLine & " tiene producci ones o certificaciones" & vbNewLine & " Perder las mediciones" & vbNewLine & " y la des composicin de la medicin!!!", vbYesNo, "ATENCIN") If Respuesta = 6 Then Else Exit Sub End If eliminar_todaslas_medicion_desc ipoint Beep Hoja4.Activate End If If trabajo_en_paralelo Then Rows(ipoint).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown

Mdulo1 - 3 Rows(ipoint + D_Proy_bis - D_Proy).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy_bis)).Insert Shift:=xlDown Ipuntos = Ipuntos - 1 borrarreferencias_bis i = Lii + 1 nuevareferencia_bis i Rows(ipoint).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown Ipuntos = Ipuntos - 1 borrarreferencias i = Lii + 1 nuevareferencia i

Else

End If limpiar Else If Binsertarlinea = True Then Binsertarlinea = False exitleavecell = False Mexcel.TextBox1.SetFocus i = Lii + 2 If trabajo_en_paralelo Then nuevareferencia_bis i Else nuevareferencia i End If exitleavecell = True End If End If

ElseIf ipoint <> 0 And Strings.Trim(Scelda) <> "" Then If Strings.Trim(Scelda) <> Strings.Trim(Hoja4.Cells(ipoint, 2)) Then If tieneproduccion(ipoint) Then Respuesta = MsgBox("Est seguro de cambiar el cdigo?" & vbNewLine & " tiene produc ciones o certificaciones" & vbNewLine & " Perder las mediciones" & vbNewLine & " y la informacin inferior!!!", vbYesNo, "ATENCIN") If Respuesta = 6 Then Else Exit Sub End If eliminar_todaslas_medicion_desc ipoint Hoja4.Activate Beep End If For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) Then IConceptos = IConceptos - 1 Exit For End If Next i If i > IConceptos Then End If IConceptos = IConceptos + 1 Hoja4.Cells(i + ipuntero + 1, 1).NumberFormat = "@" Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) referenciar If trabajo_en_paralelo Then Hoja4.Rows(ipoint).ClearContents Hoja4.Rows(ipoint - D_Proy + D_Proy_bis).ClearContents

Mdulo1 - 4 borrarreferencias_bis Hoja4.Cells(ipoint, 2).NumberFormat = "@" Hoja4.Cells(ipoint, 2) = Strings.Trim(Scelda) Hoja4.Cells(ipoint, 1) = Sposicion Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 2).NumberFormat = "@" Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 2) = Strings.Trim(Scelda) Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 1) = Sposicion Else Hoja4.Rows(ipoint).ClearContents borrarreferencias Hoja4.Cells(ipoint, 2).NumberFormat = "@" Hoja4.Cells(ipoint, 2) = Strings.Trim(Scelda) Hoja4.Cells(ipoint, 1) = Sposicion

End If Stemp2 = fijar_base_concepto If tipo_de_concepto(Scelda) = "C" Then Hoja4.Cells(i + ipuntero + 1, 4) = "C" If trabajo_en_paralelo Then Hoja4.Cells(ipoint, 3) = "C" Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 3) = "C" Stemp = Strings.Trim(Conversion.Str(ipoint)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint, 4).FormulaLocal = Stemp Stemp = Strings.Trim(Conversion.Str(ipoint - D_Proy + D_Proy_bis)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 4).FormulaLocal = Stemp Else

Hoja4.Cells(ipoint, 3) = "C" Stemp = Strings.Trim(Conversion.Str(ipoint)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint, 4).FormulaLocal = Stemp

End If Else If (InStr(1, Scelda, "%") <> 0) Then 'Filtroaux Hoja4.Cells(i + ipuntero + 1, 4) = "%" 'tipo 7 ElseIf (InStr(1, Scelda, Filtromaq) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "maq" 'tipo 2 ElseIf (InStr(1, Scelda, Filtroman) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "mo" 'tipo 1 ElseIf (InStr(1, Scelda, Filtromat) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "mat" 'tipo 3 ElseIf (InStr(1, Scelda, Filtrosub) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "sub" 'tipo 4 Else Hoja4.Cells(i + ipuntero + 1, 4) = "P" 'tipo 5 End If If trabajo_en_paralelo Then Hoja4.Cells(ipoint, 3) = "" Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 3) = "" Stemp = Strings.Trim(Conversion.Str(ipoint)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint, 4).FormulaLocal = Stemp Stemp = Strings.Trim(Conversion.Str(ipoint))

Mdulo1 - 5 Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint - D_Proy + D_Proy_bis, 4).FormulaLocal = Stemp Hoja4.Cells(ipoint, 3) = "" Stemp = Strings.Trim(Conversion.Str(ipoint)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(ipoint, 4).FormulaLocal = Stemp

Else

End If

End If End If Binsertarlinea = False Ipuntos = Ipuntos + 1 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) Then IConceptos = IConceptos - 1 Exit For End If Next i IConceptos = IConceptos + 1 Hoja4.Cells(i + ipuntero + 1, 1).NumberFormat = "@" Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) referenciar If trabajo_en_paralelo Then Hoja4.Cells(Ipuntos + D_Proy, 1) = Sposicion Hoja4.Cells(Ipuntos + D_Proy, 2).NumberFormat = "@" Hoja4.Cells(Ipuntos + D_Proy, 2) = Strings.Trim(Scelda) Hoja4.Cells(Ipuntos + D_Proy_bis, 1) = Sposicion Hoja4.Cells(Ipuntos + D_Proy_bis, 2).NumberFormat = "@" Hoja4.Cells(Ipuntos + D_Proy_bis, 2) = Strings.Trim(Scelda) Else Hoja4.Cells(Ipuntos + D_Proy, 1) = Sposicion Hoja4.Cells(Ipuntos + D_Proy, 2).NumberFormat = "@" Hoja4.Cells(Ipuntos + D_Proy, 2) = Strings.Trim(Scelda)

Else

End If Stemp2 = fijar_base_concepto If tipo_de_concepto(Scelda) = "C" Then Hoja4.Cells(i + ipuntero + 1, 4) = "C" If trabajo_en_paralelo Then Hoja4.Cells(Ipuntos + D_Proy, 3) = "C" Hoja4.Cells(Ipuntos + D_Proy_bis, 3) = "C" Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy, 4).FormulaLocal = Stemp Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy_bis)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy_bis, 4).FormulaLocal = Stemp Else Hoja4.Cells(Ipuntos + D_Proy, 3) = "C" Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy, 4).FormulaLocal = Stemp End If

Mdulo1 - 6 Else If (InStr(1, Scelda, "%") <> 0) Then 'Filtroaux Hoja4.Cells(i + ipuntero + 1, 4) = "%" ElseIf (InStr(1, Scelda, Filtromaq) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "maq" ElseIf (InStr(1, Scelda, Filtroman) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "mo" ElseIf (InStr(1, Scelda, Filtromat) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "mat" ElseIf (InStr(1, Scelda, Filtrosub) <> 0) Then Hoja4.Cells(i + ipuntero + 1, 4) = "sub" Else Hoja4.Cells(i + ipuntero + 1, 4) = "P"

End If If trabajo_en_paralelo Then Hoja4.Cells(Ipuntos + D_Proy, 3) = "" Hoja4.Cells(Ipuntos + D_Proy_bis, 3) = "" Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy, 4).FormulaLocal = Stemp Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy_bis)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy_bis, 4).FormulaLocal = Stemp Else Hoja4.Cells(Ipuntos + D_Proy, 3) = "" Stemp = Strings.Trim(Conversion.Str(Ipuntos + D_Proy)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" Hoja4.Cells(Ipuntos + D_Proy, 4).FormulaLocal = Stemp

End If End If End If End Sub Public Sub volcardatos() Dim Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto Dim i As Double, j As Double Dim numeros As Integer Dim Ilocaliza As Integer Dim Deditarcoste As Double Dim Deditarimporte As Double Dim D_med As Double Dim Dim Dim Dim Dim Dim Dim Dim Deditartotalimporte As Double Dtemp1 As Double Stemp As String d_temp_rend As Double Bcuidado As Boolean formats(0 To 4) As String d_cap As Double D_puntero As Double

If B_volcar_bis And tipoedicion = False Then volcardatos_bis 'edicion en paralelo Else formats(0) = "#,###,###,###,##0" formats(1) = "#,###,###,###,##0.0" formats(2) = "#,###,###,###,##0.00" formats(3) = "#,###,###,###,##0.000"

Mdulo1 - 7 formats(4) = "#,###,###,###,##0.0000" Bcuidado = False numeros = 1 Deditartotalimporte = 0 If tipoedicion = False Then numeros = 0 For i = (1 + D_Proy) To (Ipuntos + D_Proy) If (99 > (Hoja4.Cells(i, 1) - Base)) And ((Hoja4.Cells(i, 1) - Base)) > 0 Then Ilocaliza = Hoja4.Cells(i, 1) - Base + 1 numeros = numeros + 1 Deditarimporte = 0

D_puntero = CDbl(Hoja4.Cells(i, 4)) If Strings.Trim(Hoja4.Cells(i, 3)) = "C" Then DataPres(Ilocaliza - 1, 1) = "Cap"

prec))

If Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3) <> "" Then Deditarimporte = CDbl(Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3)) d_cap = Round(Deditarimporte, format_prec) DataPres(Ilocaliza - 1, 7) = Strings.format(Deditarimporte, formats(format_ Else DataPres(Ilocaliza - 1, 7) = Strings.format(0, formats(format_prec)) End If Else

Cells(i, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. D_puntero = j + ipuntero + 1 Exit For End If Next j End If '*** DataPres(Ilocaliza - 1, 1) = "Par"

prec))

If Hoja4.Cells(D_puntero, 5) <> "" Then Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) d_cap = Round(Deditarimporte, format_prec) DataPres(Ilocaliza - 1, 7) = Strings.format(Deditarimporte, formats(format_ Else

DataPres(Ilocaliza - 1, 7) = Strings.format(0, formats(format_prec)) End If End If

DataPres(Ilocaliza - 1, 2) = Strings.Trim(Hoja4.Cells(D_puntero, 10)) & Strings.Tri m(Hoja4.Cells(i, 3)) DataPres(Ilocaliza - 1, 3) = Strings.Trim(Hoja4.Cells(D_puntero, 1))

DataPres(Ilocaliza - 1, 4) = Strings.Trim(Hoja4.Cells(D_puntero, 2)) ' tipo de unid ad maximo 2 letras

DataPres(Ilocaliza - 1, 5) = Strings.Trim(Hoja4.Cells(D_puntero, 3)) ' texto resume n maximo 50 letras

If Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3 + 1) <> "" Then 'AQUI LA MEDICION D_med = Round(CDbl(Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3 + 1)), format_med) DataPres(Ilocaliza - 1, 6) = Strings.format(CDbl(Hoja4.Cells(i, 7 + Itipo_de_pr oyecto * 3 + 1)), formats(format_med)) Deditarimporte = Deditarimporte * D_med Else

Mdulo1 - 8 Deditarimporte = 0 DataPres(Ilocaliza - 1, 6) = Strings.format(0, formats(format_med)) End If If Deditarimporte = 0 Then DataPres(Ilocaliza - 1, 8) = Strings.format(0, formats(format_import)) Else Deditarimporte = Round(Deditarimporte, format_import) Deditartotalimporte = Deditartotalimporte + Deditarimporte rt))

DataPres(Ilocaliza - 1, 8) = Strings.format(Deditarimporte, formats(format_impo End If End If Next i Reg = numeros + 1 If Deditartotalimporte <> 0 Then Mexcel.pe.Caption = Strings.format(Deditartotalimporte, formats(formateje)) DTotalimporte = Deditartotalimporte Mexcel.Edittotalimporte.Caption = "" Else

Mexcel.pe.Caption = Strings.format("0", formats(formateje)) Mexcel.Edittotalimporte.Caption = "" DTotalimporte = 0 End If Mexcel.ListBox1.List = DataPres '*************************************************************************************** '* '* EDITOR DE PARTIDAS Y SUS DESCOMPUESTOS '* '* Else i = 0 Bdescomposicion = False Do While Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "" Bdescomposicion = True If Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "nuevalinea" Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(po sicionconcepto, 100 + i * 4)) Then Exit For End If Next j If CDbl(Hoja4.Cells(j + ipuntero + 1, 7)) < Level Then Hoja4.Cells(j + ipuntero + 1, 7) = Level End If Stemp = Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) If Stemp = "&&" Or Stemp = "Redondeo" Then DataPres(numeros, 3) = Stemp 'CODIGO DE REDONDEO Else DataPres(numeros, 3) = Stemp ' AQUI EL CODIGO End If DataPres(numeros, 1) = Hoja4.Cells(j + ipuntero + 1, 4).Value ' AQUI EL TIPO

DataPres(numeros, 4) = Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 2)) ' tipo de uni dad maximo 2 letras

DataPres(numeros, 5) = Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 3)) ' texto resum en maximo 50 letras If Hoja4.Cells(j + ipuntero + 1, 4) = "%" Then Deditarimporte = Round(Deditartotalimporte, format_precrec) recrec))

DataPres(numeros, 7) = Strings.format(Deditartotalimporte, formats(format_p

Mdulo1 - 9

ElseIf Hoja4.Cells(j + ipuntero + 1, 5) = "" Then DataPres(numeros, 7) = "" Else DataPres(numeros, 7) = Strings.format(CDbl(Hoja4.Cells(j + ipuntero + 1, 5) ), formats(format_precrec)) Deditarimporte = Round(CDbl(Hoja4.Cells(j + ipuntero + 1, 5)), format_precr ec) End If If Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1) <> "" Then

DataPres(numeros, 6) = Strings.format(CDbl(Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1)), formats(format_renrec)) d_temp_rend = Round(CDbl(Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1)), forma t_renrec) mat_imprec)) Else DataPres(numeros, 6) = "" Deditarimporte = 0 DataPres(numeros, 8) = "" End If numeros = numeros + 1 i = i + 1 Deditartotalimporte = Deditartotalimporte + Deditarimporte Else Deditarimporte = 0 numeros = numeros + 1 i = i + 1 Deditartotalimporte = Deditartotalimporte + Deditarimporte Deditarimporte = 0 End If

DataPres(numeros, 8) = Strings.format(Deditarimporte * d_temp_rend, formats(for Deditarimporte = Round(Deditarimporte * d_temp_rend, format_imprec)

Loop

If i = 0 Then DataPres(2, DataPres(2, DataPres(2, DataPres(2, DataPres(2, DataPres(2, DataPres(2,

1) 2) 3) 4) 5) 6) 7)

= = = = = = =

"" "" "" "" "" "" "" Then 1, 1) 1, 2) 1, 3) 1, 4) 1, 5) 1, 6) 1, 7) 1, 8) = = = = = = = = "" "" "" "" "" "" "" ""

ElseIf i + 1 = numeros DataPres(numeros + DataPres(numeros + DataPres(numeros + DataPres(numeros + DataPres(numeros + DataPres(numeros + DataPres(numeros + DataPres(numeros + Else

DataPres(numeros DataPres(numeros DataPres(numeros DataPres(numeros DataPres(numeros

+ + + + +

2, 2, 2, 2, 2,

1) 2) 3) 4) 5)

= = = = =

"" "" "" "" ""

Mdulo1 - 10 DataPres(numeros + 2, 6) = "" DataPres(numeros + 2, 7) = "" DataPres(numeros + 2, 8) = "" End If If Bcuidado = False Then Regcostes = numeros + 1 Else Regcostes = numeros End If If Deditartotalimporte <> 0 Then Mexcel.pe.Caption = Strings.format(Deditartotalimporte, formats(formateje)) Mexcel.Edittotalimporte.Caption = "" Else Mexcel.pe.Caption = Strings.format("0", formats(formateje)) Mexcel.Edittotalimporte.Caption = ""

End If

If Bdescomposicion Then Hoja4.Cells(posicionconcepto, 10) = "d" 'definido If Hoja4.Cells(posicionconcepto, 5) <> Deditartotalimporte Then Hoja4.Cells(posicionconcepto, 5) = Deditartotalimporte Stemp = Strings.Trim(Hoja4.Cells(posicionconcepto, 1)) 'posicion del que ha cambiad o de precio calcular_auxiliares_2 Stemp Else Hoja4.Cells(posicionconcepto, 5) = Deditartotalimporte End If Else

Hoja4.Cells(posicionconcepto, 10) = "sd" ' sin definir

End If Mexcel.ListBox2.List = DataPres End If End If End Sub Public Sub volcardatos_bis() Dim Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto Dim i As Double, j As Double, k As Double Dim numeros As Integer Dim Ilocaliza As Integer Dim Deditarcoste As Double Dim Deditarimporte As Double Dim D_med As Double Dim D_med_bis As Double Dim Deditarimporte_bis As Double Dim Deditartotalimporte As Double Dim Deditartotalimporte_bis As Double Dim D_puntero As Double Dim formats(0 To 4) As String formats(0) formats(1) formats(2) formats(3) formats(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Dim Dtemp1 As Double Dim Stemp As String Dim I_tipo As Integer 'tipo de concepto Dim Bcuidado As Boolean Bcuidado = False

Mdulo1 - 11 numeros = 1 Deditartotalimporte = 0 Deditartotalimporte_bis = 0 numeros = 0 For i = (1 + D_Proy) To (Ipuntos + D_Proy) k = i + D_Proy_paralelo - D_Proy If (99 > (Hoja4.Cells(i, 1) - Base)) And ((Hoja4.Cells(i, 1) - Base)) > 0 Then Ilocaliza = Hoja4.Cells(i, 1) - Base + 1 numeros = numeros + 1 Deditarimporte = 0 Deditarimporte_bis = 0 D_puntero = CDbl(Hoja4.Cells(i, 4))

))

If Strings.Trim(Hoja4.Cells(i, 3)) = "C" Then DataPres(Ilocaliza - 1, 1) = "Cap" If Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3) <> "" Then Deditarimporte = CDbl(Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3)) DataPres(Ilocaliza - 1, 7) = Strings.format(Deditarimporte, formats(format_prec Deditarimporte = Round(Deditarimporte, format_prec) Else

_prec))

DataPres(Ilocaliza - 1, 7) = Strings.format(0, formats(format_prec)) End If If Hoja4.Cells(k, 7 + Inum_cert_paralelo * 3) <> "" Then Deditarimporte_bis = CDbl(Hoja4.Cells(k, 7 + Inum_cert_paralelo * 3)) DataPres(Ilocaliza - 1, 10) = Strings.format(Deditarimporte_bis, formats(format Deditarimporte_bis = Round(Deditarimporte_bis, format_prec) Else DataPres(Ilocaliza - 1, 10) = Strings.format(0, formats(format_prec))

Else

End If

s(i, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell

D_puntero = j + ipuntero + 1 Exit For End If Next j End If DataPres(Ilocaliza - 1, 1) = "Par" If Hoja4.Cells(D_puntero, 5) <> "" Then Deditarimporte = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) DataPres(Ilocaliza - 1, 7) = Strings.format(CDbl(Hoja4.Cells(D_puntero, 5)), fo rmats(format_prec)) DataPres(Ilocaliza - 1, 10) = Strings.format(CDbl(Hoja4.Cells(D_puntero, 5)), f ormats(format_prec)) Deditarimporte_bis = Deditarimporte Else DataPres(Ilocaliza - 1, 7) = Strings.format(0, formats(format_prec)) DataPres(Ilocaliza - 1, 10) = Strings.format(0, formats(format_prec)) End If

End If DataPres(Ilocaliza - 1, 2) = Strings.Trim(Hoja4.Cells(D_puntero, 10)) & Strings.Trim(Ho ja4.Cells(i, 3)) DataPres(Ilocaliza - 1, 3) = Strings.Trim(Hoja4.Cells(D_puntero, 1))

DataPres(Ilocaliza - 1, 4) = Strings.Trim(Hoja4.Cells(D_puntero, 2)) ' tipo de unidad m aximo 2 letras DataPres(Ilocaliza - 1, 5) = Strings.Trim(Hoja4.Cells(D_puntero, 3)) ' texto resumen ma ximo 50 letras If Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3 + 1) <> "" Then D_med = Round(CDbl(Hoja4.Cells(i, 7 + Itipo_de_proyecto * 3 + 1)), format_med)

Mdulo1 - 12

DataPres(Ilocaliza - 1, 6) = Strings.format(CDbl(Hoja4.Cells(i, 7 + Itipo_de_proyec to * 3 + 1)), formats(format_med)) Else Deditarimporte = Deditarimporte * D_med Deditarimporte = 0 DataPres(Ilocaliza - 1, 6) = Strings.format(0, formats(format_med))

LELO

End If If Hoja4.Cells(k, 7 + Inum_cert_paralelo * 3 + 1) <> "" Then 'AQUI LA MEDICION DEL PARA

D_med_bis = Round(CDbl(Hoja4.Cells(k, 7 + Inum_cert_paralelo * 3 + 1)), format_med) DataPres(Ilocaliza - 1, 9) = Strings.format(CDbl(Hoja4.Cells(k, 7 + Inum_cert_paral elo * 3 + 1)), formats(format_med)) Else Deditarimporte_bis = Deditarimporte_bis * D_med_bis Deditarimporte_bis = 0 DataPres(Ilocaliza - 1, 9) = Strings.format(0, formats(format_med))

End If If Deditarimporte = 0 Then DataPres(Ilocaliza - 1, 8) = Strings.format(0, formats(format_import)) Else

DataPres(Ilocaliza - 1, 8) = Strings.format(Deditarimporte, formats(format_import)) Deditarimporte = Round(Deditarimporte, format_import) Deditartotalimporte = Deditartotalimporte + Deditarimporte

End If If Deditarimporte_bis = 0 Then DataPres(Ilocaliza - 1, 11) = Strings.format(0, formats(format_import)) Else ort))

DataPres(Ilocaliza - 1, 11) = Strings.format(Deditarimporte_bis, formats(format_imp Deditarimporte_bis = Round(Deditarimporte_bis, format_import) Deditartotalimporte_bis = Deditartotalimporte_bis + Deditarimporte_bis

End If End If Next i If Deditartotalimporte <> 0 Then Mexcel.pe.Caption = Strings.format(Deditartotalimporte, formats(formateje)) DTotalimporte = Deditartotalimporte Else

Mexcel.pe.Caption = Strings.format("0", formats(formateje)) DTotalimporte = 0

))

End If If Deditartotalimporte_bis <> 0 Then Mexcel.Edittotalimporte.Caption = Strings.format(Deditartotalimporte_bis, formats(formateje Else

Mexcel.Edittotalimporte.Caption = Strings.format("0", formats(formateje))

End If

Mexcel.ListBox1.List = DataPres Reg = numeros + 1 End Sub Public Sub entradaunidad(ByVal Lii As Integer, ByVal Ljj As Integer, ByVal Scelda As String)

Mdulo1 - 13 Dim i As Double Dim ipoint As Double Lii = Lii - 1 For i = (1 + D_Proy) To (Ipuntos + D_Proy) If Hoja4.Cells(i, 1) = Sposicion Then ipoint = i Exit For End If Next i If ipoint = 0 Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint, 2) Then Exit For End If Next i Hoja4.Cells(i + ipuntero + 1, 2) = Strings.Left(Scelda, 3) End Sub Public Sub entradaresumen(ByVal Lii As Integer, ByVal Ljj As Integer, ByVal Scelda As String) Dim i, ipoint As Double Lii = Lii - 1 For i = (1 + D_Proy) To (Ipuntos + D_Proy) If Hoja4.Cells(i, 1) = Sposicion Then ipoint = i Exit For End If Next i If ipoint = 0 Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint, 2) Then Exit For End If Next i Hoja4.Cells(i + ipuntero + 1, 3) = Strings.Left(Scelda, 80) End Sub Public Sub entradamedicion(ByVal Scelda As String) Dim i As Double, ipoint As Double Dim Respuesta As String Dim Dtemp As Double

ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = Sposicion Then ipoint = i Exit For End If Next i For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint + D_Proy, 2) Then Exit For End If Next i

If Hoja4.Cells(i + ipuntero + 1, 4) = "%" Then Exit Sub If Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Strings.Trim(Scelda) Then Exit Sub If Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then Respuesta = MsgBox(" Est seguro de perder la medicin descompuesta?" & vbNewLine, vbYesNo , "ATENCIN") If Respuesta = 6 Then eliminar_medicion_desc (ipoint + D_Proy) Hoja4.Activate If Strings.Trim(Scelda) <> "" Then Dtemp = CDbl(Strings.Trim(Scelda))

Mdulo1 - 14

Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Dtemp Else Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Dtemp End If End If If Strings.Trim(Scelda) <> "" Then Dtemp = CDbl(Strings.Trim(Scelda)) Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Dtemp Else

Else

Hoja4.Cells(ipoint + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = ""

End If End If Sumartodo End Sub Public Sub entradaprecioejec(ByVal Lii As Integer, ByVal Ljj As Integer, ByVal Scelda As String) Dim i As Double, ipoint As Double Dim j As Double Dim Dtemp As Double Dim Stemp As String Dim Respuesta As Integer Lii = Lii - 1 ipoint = 0 For i = 1 + D_Proy To Ipuntos + D_Proy If Hoja4.Cells(i, 1) = Sposicion Then ipoint = i Exit For End If Next i If ipoint = 0 Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint, 2) Then Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 5) = Strings.Trim(Scelda) Then Exit Sub If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" Or Hoja4.Cells(i + ipuntero + 1, 4) <> "%" Then

For j = 100 To 250 If Hoja4.Cells(i + ipuntero + 1, j) <> "" Then Exit For Next j If j < 250 Then Respuesta = MsgBox(" Est seguro de insertar precio sin descomponer?" & vbNewLine & " Per der la descomposicin del precio!!!", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Activate If Scelda = "" Then Hoja4.Cells(i + ipuntero + 1, 5) = "0" Else Dtemp = CDbl(Strings.Trim(Scelda)) Hoja4.Cells(i + ipuntero + 1, 5) = Dtemp End If For j = 100 To 255 Hoja4.Cells(i + ipuntero + 1, j) = "" Next j

Mdulo1 - 15

precio

Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de calcular_auxiliares_2 Stemp Sumartodo End If

Else

precio

Hoja4.Activate If Scelda = "" Then Hoja4.Cells(i + ipuntero + 1, 5) = "0" Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de calcular_auxiliares_2 Stemp Sumartodo

Else

precio

Dtemp = CDbl(Strings.Trim(Scelda)) Hoja4.Cells(i + ipuntero + 1, 5) = Dtemp Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de

calcular_auxiliares_2 Stemp Sumartodo End If

End If Else MsgBox "No se puede introducir importe precio en un capitulo!!!" End If End Sub Public Sub salvaultimodato() Dim Lj As Integer End Sub Public Sub bajarenarbol() Dim Li As Long Dim Dtempposicion As Double Dim Respuesta As Integer Dim Sbasetemp As Double Dim tempposicionconcepto As String Dim i As Double, ipoint As Double If tipoedicion = False Then 'editor de jerarquias Li = Lastrow If Li > Reg Then Exit Sub If Laststring = "" Then Exit Sub filaconcepto = Li posicionconcepto = 0 Sbasetemp = 100 * (Base + Li + 1)

Dtempposicion = Base + Li + 1 ipoint = 0 For i = 1 + D_Proy To Ipuntos + D_Proy If Hoja4.Cells(i, 1) = Dtempposicion Then ipoint = i 'registro que contiene la descripcin Exit For End If Next i If (ipoint = 0 Or i > Ipuntos + D_Proy) Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint, 2) Then posicionconcepto = i + ipuntero + 1 Exit For

Mdulo1 - 16

End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) = "P" Or Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 4)) = " " Then analizarportapapeles tipoedicion = True Mexcel.ListBox1.Visible = False Mexcel.ListBox2.Visible = True List_Head2 Regcostes = 1 limpiar Level = 1 nuevo_part For i = 1 To 20 Code(i) = "" Next i Code(1) = Hoja4.Cells(posicionconcepto, 1)

ElseIf Hoja4.Cells(i + ipuntero + 1, 4) = "C" Then If Sbasetemp > 100000000000000# Then Respuesta = MsgBox("No se puede!" & vbNewLine & "Solo se permiten 7 niveles", vbYes, "A TENCIN") Else Base = Sbasetemp limpiar End If Else Else End If Li = Lastrow + 1 If Li > Regcostes Then Exit Sub If Li < 1 Then Exit Sub If Laststring = "" Then Exit Sub

For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Hoja4.Cells(posicionconcepto, 100 + (Li - 1) * 4)) Then tempposicionconcepto = i + ipuntero + 1 Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) = "P" Or Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 4)) = " " Then 'solo se puede bajar si es partido If Level = 2 Then MsgBox "No se permite bajar ms de 2 niveles!!!" Else

tipoedicion = True

Mexcel.ListBox2.ListIndex = 0 limpiar Level = Level + 1 Regcostes = 1 Code(Level) = Strings.Trim(Hoja4.Cells(tempposicionconcepto, 1)) posicionconcepto = tempposicionconcepto End If Else End If

Mdulo1 - 17

End If

Hoja4.Activate End Sub Public Sub subirenarbol() Dim i As Double, ipoint As Double If tipoedicion = True Then If Level <= 1 Then tipoedicion = False Mexcel.ListBox1.Visible = True Mexcel.ListBox1.ListIndex = 0 List_Head2 Mexcel.ListBox2.Visible = False Level = 0 'level = 0 quiere decir que estamos en el editor jerarquico limpiar analizarportapapeles2 Code(Level) = "" Level = Level - 1 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Code(Level)) Then posicionconcepto = i + ipuntero + 1 Exit For End If Next i

Else

limpiar End If Else

If Base = 0 Then Base = 0 Else i = Int(Log(Base) / Log(10)) If i < 2 Then Base = 0 ElseIf i < 4 Then Base = 0 ElseIf i < 6 Then Base = 100 * Int(Base / 10000) ElseIf i < 8 Then Base = 100 * Int(Base / 10000) ElseIf i < 10 Then Base = 100 * Int(Base / 10000) ElseIf i < 12 Then Base = 100 * Int(Base / 10000) ElseIf i < 14 Then Base = 100 * Int(Base / 10000) End If End If limpiar Level = 0 End If End Sub Public Function tipo_de_concepto(descripcion As String) As String tipo_de_concepto = "" If InStr(descripcion, Filtrocap) > 0 Then tipo_de_concepto = "C" Exit Function End If

Mdulo1 - 18 If InStr(descripcion, Filtrocap2) > 0 Then tipo_de_concepto = "C" Exit Function End If If descripcion = "&&" Then 'redondeo tipo_de_concepto = "rd" ElseIf (InStr(1, descripcion, "%") <> 0) tipo_de_concepto = "%" ElseIf (InStr(1, descripcion, Filtromaq) tipo_de_concepto = "maq" ElseIf (InStr(1, descripcion, Filtroman) tipo_de_concepto = "mo" ElseIf (InStr(1, descripcion, Filtromat) tipo_de_concepto = "mat" ElseIf (InStr(1, descripcion, Filtrosub) tipo_de_concepto = "sub" Else tipo_de_concepto = "P" 'partida End If End Function Public Sub editarestado() Dim Stemp As String Dim i, ipoint As Double If tipoedicion = False Then If Base = 0 Then Mexcel.codigo.Caption = " " & "##" Mexcel.resumen.Caption = " " & Strings.Trim(Hoja7.Cells(1, 2)) Point_padre = 0 'Contiene el puntero padre en la edicion Stemp = Conversion.Str(Sposicion) i = Len(Strings.Trim(Stemp)) Stemp = Strings.Left(Strings.Trim(Stemp), i - 2) ipoint = 0 For i = 1 To Ipuntos If Hoja4.Cells(i + D_Proy, 1) = Stemp Then ipoint = i + D_Proy Exit For End If Next i

Then 'Filtroaux <> 0) Then <> 0) Then <> 0) Then <> 0) Then

Else

If ipoint = 0 Then Mexcel.codigo.Caption = " " & "##" Mexcel.resumen.Caption = " " & Strings.Trim(Hoja7.Cells(1, 2)) Point_padre = 0 'Contiene el puntero padre en la edicion Else Point_padre = ipoint For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(ipoint, 2) Then Exit For End If Next i Mexcel.codigo.Caption = " " & Strings.Trim(Hoja4.Cells(ipoint, 2)) Mexcel.resumen.Caption = " " & Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 2)) & " " & S trings.Trim(Hoja4.Cells(i + ipuntero + 1, 3)) End If Else End If

Mexcel.codigo.Caption = " " & Strings.Trim(Hoja4.Cells(posicionconcepto, 1)) Mexcel.resumen.Caption = " " & Strings.Trim(Hoja4.Cells(posicionconcepto, 2)) & " " & Strings.T rim(Hoja4.Cells(posicionconcepto, 3)) End If End Sub Public Sub Asignarformatomediciones(ii As Integer, jj As Integer) Select Case ii

Mdulo1 - 19 Case 0 formad(jj) Case 1 formad(jj) Case 2 formad(jj) Case 3 formad(jj) Case 4 formad(jj) Case 5 formad(jj) End Select = format0 = format1 = format2 = format3 = format4 = format5

End Sub Public Sub borrarreferencias() Dim i1, i2, i3, i4, i5, i6 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim TBase1, TBase2, TBase3, TBase4, TBase5, TBase6 As Double Hoja4.Activate i1 = 1 imarca1 = 0

TBase1 = Sposicion * 100 If TBase1 > 1000000000000# Then Exit Sub Do While i1 <= Ipuntos If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) > 0) Then Hoja4.Cells(i1 + D_Proy, 2) = "Deletepoint" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 2) = "Deletepoint" imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else i3 = 1 imarca3 = 0 Do While i3 <= Ipuntos If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 2) = "Deletepoint" '***************************************************** imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else

imarca4 = 0 i4 = 1 Do While i4 <= Ipuntos If ((99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) And ((Hoj a4.Cells(i4 + D_Proy, 1) - TBase4) > 0)) Then Hoja4.Cells(i4 + D_Proy, 2) = "Deletepoint" '*****************************************************

Mdulo1 - 20 imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5 )) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then

***********

Hoja4.Cells(i5 + D_Proy, 2) = "Deletepoint" '****************************************** imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

'imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Deletepoint" Loop

Hoja4.Cells(i6 + D_Proy, 2) = " End If i6 = i6 + 1

'final inser End If End If i5 = i5 + 1

Loop End If '* End If i4 = i4 + 1

Loop End If

Loop End If End If i2 = i2 + 1 Loop End If End If i1 = i1 + 1 Loop i1 = 1 Do While i1 <= Ipuntos

'****************************************************** End If i3 = i3 + 1

If Hoja4.Cells(i1 + D_Proy, 2) = "Deletepoint" Then If Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then 'eliminar_medicion_de sc ipoint 'eliminar_medicion_desc i1 + D_Proy eliminar_todaslas_medicion_desc i1 + D_Proy End If Hoja4.Activate Rows(i1 + D_Proy).Delete Shift:=xlUp

Mdulo1 - 21 'Rows(ipuntero).Insert Shift:=xlDown Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown i1 = i1 - 1 Ipuntos = Ipuntos - 1 End If i1 = i1 + 1

Loop

End Sub Public Sub borrarreferencias_bis() Dim i1, i2, i3, i4, i5, i6 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim TBase1, TBase2, TBase3, TBase4, TBase5, TBase6 As Double Hoja4.Activate i1 = 1 imarca1 = 0

TBase1 = Sposicion * 100 If TBase1 > 1000000000000# Then Exit Sub Do While i1 <= Ipuntos If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) > 0) Then Hoja4.Cells(i1 + D_Proy, 2) = "Deletepoint" Hoja4.Cells(i1 + D_Proy_bis, 2) = "Deletepoint" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 2) = "Deletepoint" Hoja4.Cells(i2 + D_Proy_bis, 2) = "Deletepoint" imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else i3 = 1 imarca3 = 0 Do While i3 <= Ipuntos If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 2) = "Deletepoint" Hoja4.Cells(i3 + D_Proy_bis, 2) = "Deletepoint" '***************************************************** imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else

imarca4 = 0 i4 = 1 Do While i4 <= Ipuntos If ((99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) And ((Hoj a4.Cells(i4 + D_Proy, 1) - TBase4) > 0)) Then Hoja4.Cells(i4 + D_Proy, 2) = "Deletepoint" Hoja4.Cells(i4 + D_Proy_bis, 2) = "Deletepoint" '***************************************************** imarca4 = imarca4 + 1

Mdulo1 - 22 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5 )) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then

int" ***********

Hoja4.Cells(i5 + D_Proy, 2) = "Deletepoint" Hoja4.Cells(i5 + D_Proy_bis, 2) = "Deletepo

'****************************************** imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

'imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Deletepoint" = "Deletepoint"

Hoja4.Cells(i6 + D_Proy, 2) = "

Hoja4.Cells(i6 + D_Proy_bis, 2) End If i6 = i6 + 1

Loop End If '* End If i4 = i4 + 1

Loop 'final insercin End If End If i5 = i5 + 1

Loop End If

Loop End If End If i2 = i2 + 1 Loop End If End If i1 = i1 + 1 Loop i1 = 1 Do While i1 <= Ipuntos

'****************************************************** End If i3 = i3 + 1

If Hoja4.Cells(i1 + D_Proy, 2) = "Deletepoint" Then If Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then 'eliminar_medicion_de sc ipoint eliminar_medicion_desc_partida i1 + D_Proy

End If If Hoja4.Cells(i1 + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then 'eliminar_medicio n_desc ipoint

Mdulo1 - 23 eliminar_medicion_desc_partida i1 + D_Proy_bis End If Hoja4.Activate Rows(i1 + D_Proy).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy)).Insert Shift:=xlDown Rows(i1 + D_Proy_bis).Delete Shift:=xlUp Rows((Ipuntos + 2 + D_Proy_bis)).Insert Shift:=xlDown i1 = i1 - 1 Ipuntos = Ipuntos - 1 End If i1 = i1 + 1

Loop

End Sub Public Sub limpiar() Dim j As Integer Dim i As Integer If tipoedicion = False Then Mexcel.ListBox1.Clear Else Mexcel.ListBox2.Clear End If For i = 1 To 100 For j = 1 To 12 DataPres(i, j) = "" Next j Next i End Sub Public Sub crearhueco() Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim Li As Long Dim Stemp As String Li = Lastrow + 1 If Li >= Reg Then Exit Sub If Li = 0 Then Exit Sub Li = Li - 1 i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If (99 - Li > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) + 1 Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) & "check" imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100 If TBase1 > 100000000000000# Then ' Exit Sub Else Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) -

Mdulo1 - 24 TBase1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) + 100 Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) & "check" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) D_Proy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

Then And ((Hoja4.Cells(i2 +

+ D_Proy, 1) + 10000 + D_Proy, 1) & "check"

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoj a4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) + 1000000 Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) & "check" 'nueva insercion imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else imarca4 = 0

e Then

i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = Tru

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4) ) And ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i 4 + D_Proy, 1) + 100000000 Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i 4 + D_Proy, 1) & "check" imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

y, 1)) = True Then

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Pro

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = H oja4.Cells(i5 + D_Proy, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy, 1) = H oja4.Cells(i5 + D_Proy, 1) & "check" 'nueva insercion imarca5 = imarca5 + 1 00

TBase6 = (TBase5 + imarca5) * 1

If TBase6 > 100000000000000# Th

Mdulo1 - 25 en Else

s(i6 + D_Proy, 1)) = True Then

'imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cell

If ((99 > (Hoja4.Ce lls(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Hoja4.Cells(i6 + D_Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) + 1000000000000# Hoja4.Cells(i6 + D_Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) & "check" End If End If i6 = i6 + 1 Loop End If 'cuidado aqui 'hasta aqui End If End If i5 = i5 + 1 Loop

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop

End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If End If i0 = i0 + 1 Loop i1 = 1 Do While i1 <= Ipuntos If Strings.Right(Hoja4.Cells(i1 + D_Proy, 1), 5) = "check" Then i2 = Len(Hoja4.Cells(i1 + D_Proy, 1)) - 5 Stemp = Strings.Left(Hoja4.Cells(i1 + D_Proy, 1), i2) Hoja4.Cells(i1 + D_Proy, 1) = Stemp Binsertarlinea = True End If i1 = i1 + 1

Loop

exitleavecell = False

Mdulo1 - 26 Mexcel.ListBox1.ListIndex = Lastrow Mexcel.TextBox1.SetFocus exitleavecell = True End Sub Public Sub crearhueco_bis() Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim Li As Long Dim Stemp As String Li = Lastrow + 1 If Li >= Reg Then Exit Sub If Li = 0 Then Exit Sub Li = Li - 1 i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If (99 - Li > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) + 1 Hoja4.Cells(i0 + D_Proy_bis, 1) = Hoja4.Cells(i0 + D_Proy_bis, 1) + 1 Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) & "check" imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100 If TBase1 > 100000000000000# Then ' Exit Sub Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) TBase1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) + 100 Hoja4.Cells(i1 + D_Proy_bis, 1) = Hoja4.Cells(i1 + D_Proy_bis, 1) + 100 Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) & "check" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else Else

imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) + 10000 Hoja4.Cells(i2 + D_Proy_bis, 1) = Hoja4.Cells(i2 + D_Proy_bis, 1) + 10000 Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) & "check" imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos

Mdulo1 - 27

If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoj a4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) + 1000000 Hoja4.Cells(i3 + D_Proy_bis, 1) = Hoja4.Cells(i3 + D_Pr oy_bis, 1) + 1000000 Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) & "check" 'nueva insercion imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else imarca4 = 0

e Then

i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = Tru

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4) ) And ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i 4 + D_Proy, 1) + 100000000 Hoja4.Cells(i4 + D_Proy_bis, 1) = Hoja4.Cel ls(i4 + D_Proy_bis, 1) + 100000000 Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i 4 + D_Proy, 1) & "check" imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

y, 1)) = True Then

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Pro

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = H oja4.Cells(i5 + D_Proy, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy_bis, 1) = Hoja4.Cells(i5 + D_Proy_bis, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy, 1) = H oja4.Cells(i5 + D_Proy, 1) & "check" 'nueva insercion imarca5 = imarca5 + 1 00 en

TBase6 = (TBase5 + imarca5) * 1

If TBase6 > 100000000000000# Th Else

s(i6 + D_Proy, 1)) = True Then

'imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cell

If ((99 > (Hoja4.Ce lls(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Hoja4.Cells(i6 + D_Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) + 1000000000000# Hoja4.Cells(i6 + D_Proy_bis, 1) = Hoja4.Cells(i6 + D_Proy_bis, 1) + 1000000000000# Hoja4.Cells(i6 + D_Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) & "check" End If End If i6 = i6 + 1 Loop End If

Mdulo1 - 28 'hasta aqui End If End If i5 = i5 + 1

Loop

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If End If i0 = i0 + 1 Loop i1 = 1 Do While i1 <= Ipuntos

Loop

If Strings.Right(Hoja4.Cells(i1 + D_Proy, 1), 5) = "check" Then i2 = Len(Hoja4.Cells(i1 + D_Proy, 1)) - 5 Stemp = Strings.Left(Hoja4.Cells(i1 + D_Proy, 1), i2) Hoja4.Cells(i1 + D_Proy, 1) = Stemp Hoja4.Cells(i1 + D_Proy_bis, 1) = Stemp Binsertarlinea = True End If i1 = i1 + 1

exitleavecell = False Lastrow = Li + 2 Mexcel.ListBox1.ListIndex = Li + 1 exitleavecell = True End Sub Public Sub nuevareferencia(ByVal Liii As Integer) Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim Li As Long Dim Stemp As String

Mdulo1 - 29 Li = Liii i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If (99 - Li > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) - 1 imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100

If TBase1 > 100000000000000# Then Exit Sub Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBas e1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) - 100 imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else

imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_P roy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) - 10000 imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.C ells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) 1000000 imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 'CUIDADO If TBase4 > 100000000000000# Then

en

Else '******************************************INSERCION imarca4 = 0 i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = True Th

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) An d ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 + D_Proy, 1) - 100000000 imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else imarca5 = 0

Mdulo1 - 30

)) = True Then

i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Proy, 1

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) - 10000000000# 'insercion imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

If ((99 > (Hoja4.Cells( i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Hoja4.Cells(i6 + D_ Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) - 1000000000000# End If End If i6 = i6 + 1 Loop End If 'cuidado este 'hasta aqui End If End If i5 = i5 + 1 Loop End If End If End If i4 = i4 + 1 Loop End If '******************************************FINAL INSERCION End If End If i3 = i3 + 1

+ D_Proy, 1)) = True Then

'imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cells(i6

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If i0 = i0 + 1 Loop

End Sub Public Sub nuevareferencia_bis(ByVal Liii As Integer) Dim Dim Dim Dim Dim i0, i1, i2, i3 As Long i4, i5, i6 As Long imarca0, imarca1, imarca2 As Long imarca3, imarca4, imarca5, imarca6 As Long TBase0, TBase1, TBase2, TBase3 As Double

Mdulo1 - 31 Dim TBase4, TBase5, TBase6 As Double Dim Li As Long Dim Stemp As String Li = Liii i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If (99 - Li > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) - 1 Hoja4.Cells(i0 + D_Proy_bis, 1) = Hoja4.Cells(i0 + D_Proy_bis, 1) - 1 imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100

If TBase1 > 100000000000000# Then Exit Sub Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBas e1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) - 100 Hoja4.Cells(i1 + D_Proy_bis, 1) = Hoja4.Cells(i1 + D_Proy_bis, 1) - 100 imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else

imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_P roy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) - 10000 Hoja4.Cells(i2 + D_Proy_bis, 1) = Hoja4.Cells(i2 + D_Proy_bis, 1) - 100 00 imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.C ells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) 1000000 Hoja4.Cells(i3 + D_Proy_bis, 1) = Hoja4.Cells(i3 + D_Proy_b is, 1) - 1000000 imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 'CUIDADO If TBase4 > 100000000000000# Then

en

Else '******************************************INSERCION imarca4 = 0 i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = True Th

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) An

Mdulo1 - 32 d ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then D_Proy, 1) - 100000000 4 + D_Proy_bis, 1) - 100000000 Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 +

Hoja4.Cells(i4 + D_Proy_bis, 1) = Hoja4.Cells(i imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

)) = True Then

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Proy, 1

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) - 10000000000# Hoja4.Cells(i5 + D_Proy_bis, 1) = H oja4.Cells(i5 + D_Proy_bis, 1) - 10000000000# 'inser imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

If ((99 > (Hoja4.Cells( i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Hoja4.Cells(i6 + D_ Proy, 1) = Hoja4.Cells(i6 + D_Proy, 1) - 1000000000000# Hoja4.Cells(i6 + D_ Proy_bis, 1) = Hoja4.Cells(i6 + D_Proy_bis, 1) - 1000000000000# End If End If i6 = i6 + 1 Loop End If 'hasta aqui End If End If i5 = i5 + 1 Loop End If End If End If i4 = i4 + 1 Loop End If '******************************************FINAL INSERCION End If End If i3 = i3 + 1

+ D_Proy, 1)) = True Then

imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cells(i6

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop

Mdulo1 - 33

End If End If i0 = i0 + 1 Loop End Sub Public Function tieneproduccion(Linea As Double) As Boolean Dim Di As Integer 'ipoint + D_Proy Di = 0 tieneproduccion = False If trabajo_en_paralelo = False Then Do While Hoja4.Cells(Linea, 7 + Di * 3 + 1) = "" Or CDbl(Hoja4.Cells(Linea, 7 + Di * 3 + 1)) = 0 '+ D_Proy_bis- D_Proy If (7 + Di * 3) >= 252 Then Exit Function End If Di = Di + 1

Else

Loop If (7 + Di * 3) < 252 Then tieneproduccion = True End If

Do While (Hoja4.Cells(Linea, 7 + Di * 3 + 1) = "" Or CDbl(Hoja4.Cells(Linea, 7 + Di * 3 + 1)) = 0) And (Hoja4.Cells(Linea + D_Proy_bis - D_Proy, 7 + Di * 3 + 1) = "" Or CDbl(Hoja4.Cells(Linea + D_Proy_bis - D_Proy, 7 + Di * 3 + 1)) = 0) ' If (7 + Di * 3) >= 252 Then Exit Function End If Di = Di + 1

Loop If (7 + Di * 3) < 252 Then tieneproduccion = True End If End If ' End Function Public Sub actualizavariablesmesobrayedicion() 'se puede borrar End Sub Public Sub nuevo() Dim j As Integer Dim format(0 To 4) As String 'presupuesto jerarquico format(0) = "#,###,###,###,##0" format(1) = "#,###,###,###,##0.0" format(2) = "#,###,###,###,##0.00" format(3) = "#,###,###,###,##0.000" format(4) = "#,###,###,###,##0.0000" exitleavecell = False format_med = Hoja7.Range("B15") format_prec = Hoja7.Range("B16") format_import = Hoja7.Range("B17") formateje = format_import format_renrec = Hoja7.Range("B18") format_precrec = Hoja7.Range("B19")

Mdulo1 - 34 format_imprec = Hoja7.Range("B20") exitleavecell = True

End Sub Public Sub nuevo_part() Dim j As Integer Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

exitleavecell = False format_renrec = Hoja7.Range("B18") format_precrec = Hoja7.Range("B19") format_imprec = Hoja7.Range("B20") exitleavecell = True formateje = Hoja7.Range("B16") 'corresponde al del precio del proyecto (no del descomposicion) End Sub Public Sub entradacodigo_aux(ByVal Lii As Integer, ByVal Ljj As Integer, ByVal Scelda As String) Dim Respuesta As Integer Dim tip_concep As String Dim Celda1, Celda4 As Range Dim i, j As Integer Lii = Lii + 1 Scelda = Strings.Left(Scelda, 12) If car_raros(Scelda) Then limpiar Exit Sub End If tip_concep = tipo_de_concepto(Scelda) If tip_concep = "C" Then Exit Sub ' ES UN CAPITULO If Strings.Trim(Scelda) = "" Then If Binsertarlinea = True Then Binsertarlinea = False exitleavecell = False Set Celda1 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Set Celda4 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 3) Hoja4.Range(Celda1, Celda4).Delete Shift:=xlToLeft exitleavecell = True Else bia algo

If Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) <> "" Then 'se comprueba que antes ha Respuesta = MsgBox("Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then Set Celda1 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Set Celda4 = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 3) Hoja4.Range(Celda1, Celda4).Delete Shift:=xlToLeft limpiar End If

Else

Mdulo1 - 35 End If End If

Else

If Strings.Trim(Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) = Strings.Trim(Scelda)) Then Exit Sub If Scelda = "&&" Then 'concepto tipo redondeo i = 3 Scelda = "Redondeo" Else i = comprobar_insert_auxiliar(Scelda) End If If 2 = i Then ElseIf i = 1 Then Else '*********************************************************************************** ' NO HAY REFERENCIA TRIANGULAR

'*********************************************************************************** If Binsertarlinea = False Then If ((Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4)) <> "" And Strings.Trim(Hoja4.C ells(posicionconcepto, 100 + (Lii - 1) * 4)) <> Strings.Trim(Scelda)) Then Respuesta = MsgBox("Est seguro de cambiar?", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) = Strings.Trim(Scelda) Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 1) = "" Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 2) = "" Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 3) = "" End If Else

Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, End If

100 100 100 100

+ + + +

(Lii (Lii (Lii (Lii

1) 1) 1) 1)

* * * *

4) = Strings.Trim(Scelda) 4 + 1) = "" 4 + 2) = "" 4 + 3) = ""

For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) Then IConceptos = IConceptos - 1 Exit For End If Next i IConceptos = IConceptos + 1

s 1

Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) Hoja4.Cells(i + ipuntero + 1, 4) = tip_concep If tip_concep = "rd" Then Hoja4.Cells(i + ipuntero + 1, 5) = 1 'en principio el precio del redondeo siempre e Hoja4.Cells(i + ipuntero + 1, 3) = "REDONDEO" End If If Hoja4.Cells(i + ipuntero + 1, 7) = "" Then Else End If Binsertarlinea = False Hoja4.Cells(posicionconcepto, 100 Hoja4.Cells(posicionconcepto, 100 Hoja4.Cells(posicionconcepto, 100 Hoja4.Cells(posicionconcepto, 100 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + IConceptos = IConceptos Exit For

+ + + +

(Lii (Lii (Lii (Lii

1) 1) 1) 1)

* * * *

4) = Strings.Trim(Scelda) 4 + 1) = "" 4 + 2) = "" 4 + 3) = ""

1, 1) = Strings.Trim(Scelda) Then 1

Mdulo1 - 36 End If Next i IConceptos = IConceptos + 1

Hoja4.Cells(i + ipuntero + 1, 1) = Strings.Trim(Scelda) Hoja4.Cells(i + ipuntero + 1, 4) = tip_concep If tip_concep = "rd" Then Hoja4.Cells(i + ipuntero + 1, 5) = 1 'en principio el precio del redondeo SIEMPRE 1 Hoja4.Cells(i + ipuntero + 1, 3) = "REDONDEO" End If If Hoja4.Cells(i + ipuntero + 1, 7) = "" Then End If End If End If End If End Sub Public Sub entradaunidad_aux(ByVal Lii As Integer, ByVal Scelda As String) Dim i As Integer Lii = Lii + 1 For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Then Exit For End If Next i Hoja4.Cells(i + ipuntero + 1, 2) = Strings.Left(Scelda, 3) End Sub Public Sub entradaresumen_aux(ByVal Lii As Integer, ByVal Scelda As String) Dim i As Integer Lii = Lii + 1 If Strings.Trim(Laststring) = "Redondeo" Then Exit Sub If Strings.Trim("&&") = "Redondeo" Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Then Exit For End If Next i Hoja4.Cells(i + ipuntero + 1, 3) = Strings.Left(Scelda, 50) End Sub Public Sub entradaprecioejec_aux(ByVal Lii As Integer, ByVal Scelda As String) Dim i As Integer Dim j As Integer Dim RightCell As Range Dim Dtemp As Double Dim Respuesta As Integer Dim Stemp As String Lii = Lii + 1 If Strings.Trim(Laststring) = "Redondeo" Then Exit Sub For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4) Then Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) <> "C" Then For j = 100 To 250 If Hoja4.Cells(i + ipuntero + 1, j) <> "" Then Exit For Next j

Mdulo1 - 37

If j < 250 Then Respuesta = MsgBox(" Est seguro de insertar precio sin descomponer?" & vbNewLine & " Per der la descomposicin del precio!!!", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Activate If Scelda = "" Then Hoja4.Cells(i + ipuntero + 1, 5) = "O" Sumartodo Else Dtemp = CDbl(Strings.Trim(Scelda)) Hoja4.Cells(i + ipuntero + 1, 5) = Dtemp Sumartodo End If

precio

Hoja4.Cells(i + ipuntero + 1, 12).Select Set RightCell = Cells(ActiveCell.Row, 256) Range(ActiveCell, RightCell).Clear ' se borra los auxiliares Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de calcular_auxiliares_2 Stemp Sumartodo End If

Else

precio

Hoja4.Activate If Scelda = "" Then Hoja4.Cells(i + ipuntero + 1, 5) = "0" Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de calcular_auxiliares_2 Stemp Sumartodo

Else

precio

Dtemp = CDbl(Strings.Trim(Scelda)) Hoja4.Cells(i + ipuntero + 1, 5) = Dtemp Stemp = Strings.Trim(Hoja4.Cells(i + ipuntero + 1, 1)) 'posicion del que ha cambiado de

calcular_auxiliares_2 Stemp Sumartodo End If

End If Else MsgBox "No se puede introducir importe precio en un capitulo!!!" End If End Sub Public Sub entradarendimiento(ByVal Lii As Integer, ByVal Scelda As String) Dim RightCell As Range Dim drecur As Double Lii = Lii + 1 If Strings.Trim(Scelda) = "" Then Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 1) = "" ElseIf IsNumeric(Scelda) Then drecur = CDbl(Scelda) Hoja4.Cells(posicionconcepto, 100 + (Lii - 1) * 4 + 1) = drecur End If End Sub Public Sub crearhueco_aux() Dim Li As Long Dim Stemp As String Li = Lastrow - 1

Mdulo1 - 38 If Li >= Regcostes Then Exit Sub If Li = 0 Then Exit Sub Li = Li - 1 Binsertarlinea = True Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, Hoja4.Cells(posicionconcepto, exitleavecell = False Mexcel.Cuadro.Cells.Range("A2:K900").ClearContents Mexcel.Cuadro.Cells.Range("A1").Select Lastcol = 3 Lastrow = Li + 2 Mexcel.Cuadro.ActiveCell.Offset(Li + 1, 2).Select exitleavecell = True End Sub Public Sub Sumartodofinal() Dim i, j As Integer Dim Dtemp As Double Dim DSumaImport As Double Dim Dtemp1, Dtemp2 As Double Dim D_puntero As Double DSumaImport = 0 For i = 1 To Ipuntos 100 100 100 100 100 100 100 100 + + + + + + + + Li Li Li Li Li Li Li Li * * * * * * * * 4).Insert 4).Insert 4).Insert 4).Insert Shift:=xlToRight Shift:=xlToRight Shift:=xlToRight Shift:=xlToRight

4) = "nuevalinea" 4 + 1) = "" 4 + 2) = "" 4 + 3) = ""

Then

If (99 > (Hoja4.Cells(i + D_Proy, 1) - Base)) And ((Hoja4.Cells(i + D_Proy, 1) - Base)) > 0 Dtemp = CDbl(Hoja4.Cells(i + D_Proy, 1)) ' * 1000 D_puntero = CDbl(Hoja4.Cells(i + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i + D_Proy, 3)) = "C" Then sumarparcialesfinal (Dtemp) Hoja4.Cells(i + D_Proy, 7 + Itipo_de_proyecto * 3) = DTotalimporte DSumaImport = DSumaImport + DTotalimporte Else

If Base = 0 Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i + D_Proy, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. Cells(i + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = CDbl(Hoja4.Cells(D_puntero, 5)) 'importe de ejecucion presupuesto

Dtemp2 = CDbl(Hoja4.Cells(i + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)) 'medicion de presupuesto, osea proyecto Dtemp1 = Dtemp1 * Dtemp2 Dtemp1 = Round(Dtemp1, format_import) DSumaImport = DSumaImport + Dtemp1 End If End If

Mdulo1 - 39 End If Next i If Base = 0 Then Hoja4.Cells(ipuntero + 1, 5) = DSumaImport End If End Sub Public Function sumarparcialesfinal(TBase1 As Double) As Boolean Dim j As Integer Dim Dtemp1, Dtemp2, Dtemp3 As Double Dim i1, i2, i3, i4 As Long Dim i5, i6, i7 As Long Dim imarca1, imarca2, imarca3 As Long Dim imarca4, imarca5, imarca6 As Long Dim TBase2, TBase3, TBase4 As Double Dim TBase5, TBase6, TBase7 As Double Dim DTCapitulo, DTCapitulo1, DTCapitulo2, DTCapitulo3 As Double Dim DTCapitulo4, DTCapitulo5, DTCapitulo6 As Double Dim D_puntero As Double sumarparcialesfinal = True i1 = 1 imarca1 = 0 DTotalimporte = 0

If TBase1 > 1000000000000# Then Exit Function Do While i1 <= Ipuntos If Hoja4.Cells(i1 + D_Proy, 1) = TBase1 Then

DTCapitulo = 0 TBase2 = (TBase1) * 100 D_puntero = CDbl(Hoja4.Cells(i1 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i1 + D_Proy, 3)) <> "C" Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1 + D_Proy, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'importe de ejecucion pres upuesto Dtemp2 = Round(CDbl(Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_me d) 'medicion de presupuesto, osea proyecto DTotalimporte = DTotalimporte + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase2 > 1000000000000# Then imarca2 = 0 i2 = 1 DTCapitulo1 = 0 Do While i2 <= Ipuntos If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) > 0 Then Else

hen

imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 D_puntero = CDbl(Hoja4.Cells(i2 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i2 + D_Proy, 3)) <> "C" Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2 + D_Proy, 2)) T

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho ja4.Cells(i2 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If

Mdulo1 - 40

ecucion presupuesto

Next j End If Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'importe de ej

Dtemp2 = Round(CDbl(Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) ), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo1 = DTCapitulo1 + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase3 > 1000000000000# Then DTCapitulo2 = 0 imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 D_puntero = CDbl(Hoja4.Cells(i3 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i3 + D_Proy, 3)) <> "C" Then _Proy, 2)) Then Else

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3 + D

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Str ings.Trim(Hoja4.Cells(i3 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'i mporte de ejecucion presupuesto Dtemp2 = Round(CDbl(Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proye cto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto t)

DTCapitulo2 = DTCapitulo2 + Round(Dtemp1 * Dtemp2, format_impor ElseIf TBase4 > 1000000000000# Then Else

i4 = 1 DTCapitulo3 = 0 imarca4 = 0 Do While i4 <= Ipuntos If ((99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) And ((Hoj a4.Cells(i4 + D_Proy, 1) - TBase4) > 0)) Then

n Cells(i4 + D_Proy, 2)) Then

imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 D_puntero = CDbl(Hoja4.Cells(i4 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i4 + D_Proy, 3)) <> "C" The

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i4 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If mat_prec) 'importe de ejecucion presupuesto

Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), for

Dtemp2 = Round(CDbl(Hoja4.Cells(i4 + D_Proy, 7 + It ipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo3 = DTCapitulo3 + Round(Dtemp1 * Dtemp2, format_import)

Mdulo1 - 41 ElseIf TBase5 > 1000000000000# Then '*********************************************** 'aqui 5 nivel Else

i5 = 1 DTCapitulo4 = 0 imarca5 = 0 Do While i5 <= Ipuntos If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5 )) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then

)) ) <> "C" Then .Trim(Hoja4.Cells(i5 + D_Proy, 2)) Then

imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 D_puntero = CDbl(Hoja4.Cells(i5 + D_Proy, 4

If Strings.Trim(Hoja4.Cells(i5 + D_Proy, 3)

If Hoja4.Cells(D_puntero, 1) <> Strings

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i5 + D_Proy, 2)) Then D_puntero = j + ipuntero + Exit For End If Next j End If

ro, 5)), format_prec) 'importe de ejecucion presupuesto

Dtemp1 = Round(CDbl(Hoja4.Cells(D_punte

Dtemp2 = Round(CDbl(Hoja4.Cells(i5 + D_ Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo4 = DTCapitulo4 + Round(Dtemp 1 * Dtemp2, format_import) ElseIf TBase6 > 1000000000000# Then '****************************************** ***** 'aqui 6 nivel Else i6 = 1 DTCapitulo5 = 0 imarca6 = 0 Do While i6 <= Ipuntos If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then

00 + D_Proy, 4)) + D_Proy, 3)) <> "C" Then ) <> Strings.Trim(Hoja4.Cells(i6 + D_Proy, 2)) Then

imarca6 = imarca6 + 1 TBase7 = (TBase6 + imarca6) * 1

D_puntero = CDbl(Hoja4.Cells(i6 If Strings.Trim(Hoja4.Cells(i6

'** If Hoja4.Cells(D_puntero, 1

For j = 1 To IConceptos If Strings.Trim(Hoj a4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i6 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.C ells(D_puntero, 5)), format_prec) 'importe de ejecucion presupuesto Dtemp2 = Round(CDbl(Hoja4.C ells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proye cto DTCapitulo5 = DTCapitulo5 + Round(Dtemp1 * Dtemp2, format_import)

Mdulo1 - 42 # Then *****************

ElseIf TBase7 > 100000000000000

'******************************

'aqui 7 nivel Else i7 = 1 DTCapitulo6 = 0 Do While i7 <= Ipuntos If ((99 > (Hoja4.Cells( i7 + D_Proy, 1) - TBase7)) And ((Hoja4.Cells(i7 + D_Proy, 1) - TBase7) > 0)) Then ntero, 1) <> Strings.Trim(Hoja4.Cells(i7 + D_Proy, 2)) Then onceptos

If Hoja4.Cells(D_pu

For j = 1 To IC

Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7 + D_Proy, 2)) Then ro = j + ipuntero + 1 r

If Strings.

D_punte

Exit Fo

ja4.Cells(i7 + D_Proy, 4)) a4.Cells(i7 + D_Proy, 3)) <> "C" Then CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'importe de ejecucion presupuesto

End If Next j End If D_puntero = CDbl(Ho

If Strings.Trim(Hoj

Dtemp1 = Round(

Dtemp2 = Round( CDbl(Hoja4.Cells(i7 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto , osea proyecto DTCapitulo6 = D TCapitulo6 + Round(Dtemp1 * Dtemp2, format_import) End If End If i7 = i7 + 1

ells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) + Itipo_de_proyecto * 3) = DTCapitulo6 Round(DTCapitulo6 * Dtemp2, format_import) ********************

Loop Dtemp2 = Round(CDbl(Hoja4.C Hoja4.Cells(i6 + D_Proy, 7

DTCapitulo5 = DTCapitulo5 +

'****************************** End If End If Loop i6 = i6 + 1

Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) royecto * 3) = DTCapitulo5 itulo5 * Dtemp2, format_import)

Dtemp2 = Round(CDbl(Hoja4.Cells(i5 + D_

Hoja4.Cells(i5 + D_Proy, 7 + Itipo_de_p

DTCapitulo4 = DTCapitulo4 + Round(DTCap

End If

********

'FINAL DE LA SEGUNDA AMPLIACION '****************************************** End If Loop i5 = i5 + 1

Mdulo1 - 43 ipo_de_proyecto * 3 + 1)), format_med) = DTCapitulo4 mp2, format_import)

Dtemp2 = Round(CDbl(Hoja4.Cells(i4 + D_Proy, 7 + It

Hoja4.Cells(i4 + D_Proy, 7 + Itipo_de_proyecto * 3)

DTCapitulo3 = DTCapitulo3 + Round(DTCapitulo4 * Dte End If 'aqui se acaba 'final de la primera ampliacion '************************************************** End If Loop i4 = i4 + 1

cto * 3 + 1)), format_med) o3 import)

Dtemp2 = Round(CDbl(Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proye

Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitul

DTCapitulo2 = DTCapitulo2 + Round(DTCapitulo3 * Dtemp2, format_ End If 'aqui se acaba End If i3 = i3 + 1

), format_med)

Loop Dtemp2 = Round(CDbl(Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitulo2 DTCapitulo1 = DTCapitulo1 + Round(DTCapitulo2 * Dtemp2, format_import) End If End If i2 = i2 + 1

Loop Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitulo1 DTotalimporte = DTotalimporte + DTCapitulo1 End If End If i1 = i1 + 1 Loop End Function Public Sub Sumartodo() Dim i, j As Integer Dim Dtemp As Double Dim DSumaImport As Double Dim Dtemp1, Dtemp2 As Double Dim D_puntero As Double DSumaImport = 0 If calculocontinuo Then For i = 1 To Ipuntos Then

If (99 > (Hoja4.Cells(i + D_Proy, 1) - Base)) And ((Hoja4.Cells(i + D_Proy, 1) - Base)) > 0 Dtemp = CDbl(Hoja4.Cells(i + D_Proy, 1)) ' * 1000 D_puntero = CDbl(Hoja4.Cells(i + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i + D_Proy, 3)) = "C" Then sumarparciales (Dtemp) Hoja4.Cells(i + D_Proy, 7 + Itipo_de_proyecto * 3) = DTotalimporte DSumaImport = DSumaImport + DTotalimporte Else

Mdulo1 - 44

If Base = 0 Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i + D_Proy, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. Cells(i + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If

to

Dtemp1 = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) 'importe de ejecucion presupues

Dtemp2 = CDbl(Hoja4.Cells(i + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)) 'medicion de presupuesto, osea proyecto Dtemp1 = Dtemp1 * Dtemp2 Dtemp1 = Round(Dtemp1, format_import) DSumaImport = DSumaImport + Dtemp1 End If End If

End If Next i If Base = 0 Then Hoja4.Cells(ipuntero + 1, 5) = DSumaImport End If Else 'truco para no sumer todo If tipoedicion = False Then If Point_padre = 0 Then Else Else Hoja4.Cells(Point_padre, 7 + Itipo_de_proyecto * 3) = DTotalimporte End If

mna 5 End If

'estamos en el editor de partidas 'volcarconceptos pone automaticamente el importe de la suma de los descompuestos en la colu

End If End Sub Public Function sumarparciales(TBase1 As Double) As Boolean Dim j As Integer Dim Dtemp1, Dtemp2 As Double Dim i1, i2, i3, i4 As Long Dim i5, i6, i7 As Long Dim imarca1, imarca2, imarca3 As Long Dim imarca4, imarca5, imarca6 As Long Dim TBase2, TBase3, TBase4 As Double Dim TBase5, TBase6, TBase7 As Double Dim DTCapitulo, DTCapitulo1, DTCapitulo2, DTCapitulo3 As Double Dim DTCapitulo4, DTCapitulo5, DTCapitulo6 As Double Dim D_puntero As Double sumarparciales = True i1 = 1 imarca1 = 0 DTotalimporte = 0 If TBase1 > 1000000000000# Then Exit Function Do While i1 <= Ipuntos If Hoja4.Cells(i1 + D_Proy, 1) = TBase1 Then DTCapitulo = 0 TBase2 = (TBase1) * 100 D_puntero = CDbl(Hoja4.Cells(i1 + D_Proy, 4))

If Strings.Trim(Hoja4.Cells(i1 + D_Proy, 3)) <> "C" Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1 + D_Proy, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1 + D_Proy, 2)) Then

Mdulo1 - 45 D_puntero = j + ipuntero + 1 Exit For End If Next j End If

d)

Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) Dtemp2 = Round(CDbl(Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_me DTotalimporte = DTotalimporte + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase2 > 1000000000000# Then Else imarca2 = 0 i2 = 1 DTCapitulo1 = 0

Do While i2 <= Ipuntos If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 D_puntero = CDbl(Hoja4.Cells(i2 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i2 + D_Proy, 3)) <> "C" Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2 + D_Proy, 2)) T hen For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho ja4.Cells(i2 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If ecucion presupuesto

Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'importe de ej

Dtemp2 = Round(CDbl(Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) ), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo1 = DTCapitulo1 + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase3 > 1000000000000# Then Else DTCapitulo2 = 0

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.Cells(i3 + D_Proy, 1) - TBase3) > 0)) Then

_Proy, 2)) Then

imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 D_puntero = CDbl(Hoja4.Cells(i3 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i3 + D_Proy, 3)) <> "C" Then If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3 + D

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Str ings.Trim(Hoja4.Cells(i3 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'i mporte de ejecucion presupuesto Dtemp2 = Round(CDbl(Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proye cto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto t)

DTCapitulo2 = DTCapitulo2 + Round(Dtemp1 * Dtemp2, format_impor

Mdulo1 - 46 ElseIf TBase4 > 1000000000000# Then Else

i4 = 1 DTCapitulo3 = 0 imarca4 = 0 Do While i4 <= Ipuntos If ((99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) And ((Hoj a4.Cells(i4 + D_Proy, 1) - TBase4) > 0)) Then

n Cells(i4 + D_Proy, 2)) Then

imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 D_puntero = CDbl(Hoja4.Cells(i4 + D_Proy, 4)) If Strings.Trim(Hoja4.Cells(i4 + D_Proy, 3)) <> "C" The

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i4 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.Cells(D_puntero, 5)), for mat_prec) 'importe de ejecucion presupuesto Dtemp2 = Round(CDbl(Hoja4.Cells(i4 + D_Proy, 7 + It ipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo3 = DTCapitulo3 + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase5 > 1000000000000# Then Else

i5 = 1 DTCapitulo4 = 0 imarca5 = 0 Do While i5 <= Ipuntos If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5 )) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 )) ) <> "C" Then .Trim(Hoja4.Cells(i5 + D_Proy, 2)) Then

D_puntero = CDbl(Hoja4.Cells(i5 + D_Proy, 4

If Strings.Trim(Hoja4.Cells(i5 + D_Proy, 3)

If Hoja4.Cells(D_puntero, 1) <> Strings

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i5 + D_Proy, 2)) Then D_puntero = j + ipuntero + Exit For End If Next j End If

ro, 5)), format_prec) 'importe de ejecucion presupuesto

Dtemp1 = Round(CDbl(Hoja4.Cells(D_punte

Dtemp2 = Round(CDbl(Hoja4.Cells(i5 + D_ Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proyecto DTCapitulo4 = DTCapitulo4 + Round(Dtemp 1 * Dtemp2, format_import) ElseIf TBase6 > 1000000000000# Then Else i6 = 1 DTCapitulo5 = 0 imarca6 = 0

Mdulo1 - 47

Do While i6 <= Ipuntos If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then

00 + D_Proy, 4)) + D_Proy, 3)) <> "C" Then ) <> Strings.Trim(Hoja4.Cells(i6 + D_Proy, 2)) Then

'******** imarca6 = imarca6 + 1 TBase7 = (TBase6 + imarca6) * 1

D_puntero = CDbl(Hoja4.Cells(i6 If Strings.Trim(Hoja4.Cells(i6

If Hoja4.Cells(D_puntero, 1

For j = 1 To IConceptos If Strings.Trim(Hoj a4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i6 + D_Proy, 2)) Then D_puntero = j + ipuntero + 1 Exit For End If Next j End If Dtemp1 = Round(CDbl(Hoja4.C ells(D_puntero, 5)), format_prec) 'importe de ejecucion presupuesto Dtemp2 = Round(CDbl(Hoja4.C ells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuesto, osea proye cto DTCapitulo5 = DTCapitulo5 + Round(Dtemp1 * Dtemp2, format_import) ElseIf TBase6 > 100000000000000 # Then Else

i7 = 1 DTCapitulo6 = 0

*****

'**************************

'NIVEL 7 Do While i7 <= Ipuntos If ((99 > (Hoja4.Cells( i7 + D_Proy, 1) - TBase7)) And ((Hoja4.Cells(i7 + D_Proy, 1) - TBase7) > 0)) Then ja4.Cells(i7 + D_Proy, 4)) a4.Cells(i7 + D_Proy, 3)) <> "C" Then (D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i7 + D_Proy, 2)) Then o IConceptos

D_puntero = CDbl(Ho

If Strings.Trim(Hoj

If Hoja4.Cells

For j = 1 T

ngs.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7 + D_Proy, 2)) Then untero = j + ipuntero + 1 t For

If Stri

D_p

Exi End If Next j End If

(CDbl(Hoja4.Cells(D_puntero, 5)), format_prec) 'importe de ejecucion presupuesto

Dtemp1 = Round

Dtemp2 = Round (CDbl(Hoja4.Cells(i7 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) 'medicion de presupuest o, osea proyecto DTCapitulo6 = DTCapitulo6 + Round(Dtemp1 * Dtemp2, format_import) Else End If

Mdulo1 - 48 End If i7 = i7 + 1

ells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) + Itipo_de_proyecto * 3) = DTCapitulo6 Round(DTCapitulo6 * Dtemp2, format_import)

Loop 'AQUI Dtemp2 = Round(CDbl(Hoja4.C Hoja4.Cells(i6 + D_Proy, 7

DTCapitulo5 = DTCapitulo5 + End If End If ' CUIDADO CON EL IF i6 = i6 + 1 Loop 'i6

************************* Proy, 7 + Itipo_de_proyecto * 3 + 1)), format_med) royecto * 3) = DTCapitulo5 itulo5 * Dtemp2, format_import)

'**************************************

'SEGUNDA VEZ Dtemp2 = Round(CDbl(Hoja4.Cells(i5 + D_

Hoja4.Cells(i5 + D_Proy, 7 + Itipo_de_p

DTCapitulo4 = DTCapitulo4 + Round(DTCap End If ' CUIDADO CON EL IF End If i5 = i5 + 1 Loop 'DEL I5

****

'************************************************** 'UNA VEZ

ipo_de_proyecto * 3 + 1)), format_med) = DTCapitulo4 mp2, format_import)

Dtemp2 = Round(CDbl(Hoja4.Cells(i4 + D_Proy, 7 + It

Hoja4.Cells(i4 + D_Proy, 7 + Itipo_de_proyecto * 3)

DTCapitulo3 = DTCapitulo3 + Round(DTCapitulo4 * Dte End If End If Loop i4 = i4 + 1

cto * 3 + 1)), format_med) o3 import)

Dtemp2 = Round(CDbl(Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proye

Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitul

DTCapitulo2 = DTCapitulo2 + Round(DTCapitulo3 * Dtemp2, format_ End If End If i3 = i3 + 1

), format_med)

Loop Dtemp2 = Round(CDbl(Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitulo2 DTCapitulo1 = DTCapitulo1 + Round(DTCapitulo2 * Dtemp2, format_import) End If End If i2 = i2 + 1

Loop Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3) = DTCapitulo1 DTotalimporte = DTotalimporte + DTCapitulo1

Mdulo1 - 49 End If End If i1 = i1 + 1 Loop End Function Public Sub copiar_conceptos(ByVal Lii As Double) '(ByVal Lii As Integer) Dim i0, i1, i2, i3 As Long Dim i4, i5, i6, i7 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5, imarca6 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim DBase1, DBase2, DBase3 As Double Dim DBase4, DBase5, DBase6 As Double 'Dim Li As Long Dim Stemp As String Dim Icontador As Integer Dim Icuenta As Integer i0 = 1 Icontador = 1 Icuenta = 1 imarca0 = 0 TBase0 = Base_copia 'Base_copia = (Base + Lii - 1) Hoja8.Activate Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If CDbl(Hoja4.Cells(i0 + D_Proy, 1)) = (TBase0 + Icuenta) Then If Icuenta > num_reg_copia Then Exit Sub Hoja8.Cells(Icontador, 1) = Hoja4.Cells(i0 + D_Proy, 1) - Base_copia ' + 1 Hoja8.Cells(Icontador, 2) = Hoja4.Cells(i0 + D_Proy, 2) Hoja8.Cells(Icontador, 7) = Hoja4.Cells(i0 + D_Proy, 7 + Itipo_de_proyecto * 3) Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i0 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) If Hoja4.Cells(i0 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then Hoja8.Cells(Icontador, 7 + 0 * 3 + 2) = CDbl(Hoja1.Cells(1, 242)) copiar_medicion_desc i0 End If Icuenta = Icuenta + 1 Icontador = Icontador + 1 imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100 DBase1 = (Hoja4.Cells(i0 + D_Proy, 1) - Base_copia) * 100 i0 = 0 'para que vuelva a buscar desde el principio If TBase1 > 100000000000000# Then Exit Sub

Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBas e1) > 0) Then imarca1 = imarca1 + 1 Hoja8.Cells(Icontador, 1) = DBase1 + imarca1 Hoja8.Cells(Icontador, 2) = Hoja4.Cells(i1 + D_Proy, 2) Hoja8.Cells(Icontador, 7) = Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3) Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) If Hoja4.Cells(i1 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then Hoja8.Cells(Icontador, 7 + 0 + 2) = CDbl(Hoja1.Cells(1, 242)) copiar_medicion_desc i1 End If Icontador = Icontador + 1 TBase2 = (TBase1 + imarca1) * 100 DBase2 = (DBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else

Mdulo1 - 50

imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_P roy, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 Hoja8.Cells(Icontador, 1) = DBase2 + imarca2 Hoja8.Cells(Icontador, 2) = Hoja4.Cells(i2 + D_Proy, 2) Hoja8.Cells(Icontador, 7) = Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proye cto * 3) Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_p royecto * 3 + 1) If Hoja4.Cells(i2 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then Hoja8.Cells(Icontador, 7 + 0 + 2) = CDbl(Hoja1.Cells(1, 242)) copiar_medicion_desc i2 End If Icontador = Icontador + 1 TBase3 = (TBase2 + imarca2) * 100 DBase3 = (DBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.C ells(i3 + D_Proy, 1) - TBase3) > 0)) Then imarca3 = imarca3 + 1 Hoja8.Cells(Icontador, 1) = DBase3 + imarca3 Hoja8.Cells(Icontador, 2) = Hoja4.Cells(i3 + D_Proy, 2) ipo_de_proyecto * 3) + Itipo_de_proyecto * 3 + 1) <> "" Then ))

Hoja8.Cells(Icontador, 7) = Hoja4.Cells(i3 + D_Proy, 7 + It Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i3 + D_Proy, 7 If Hoja4.Cells(i3 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2)

Hoja8.Cells(Icontador, 7 + 2) = CDbl(Hoja1.Cells(1, 242 copiar_medicion_desc i3 End If Icontador = Icontador + 1 TBase4 = (TBase3 + imarca3) * 100 DBase4 = (DBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else imarca4 = 0

en

i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = True Th

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) An d ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then imarca4 = imarca4 + 1 Hoja8.Cells(Icontador, 1) = DBase4 + imarca4 Hoja8.Cells(Icontador, 2) = Hoja4.Cells(i4 + D_ Proy, 2) Hoja8.Cells(Icontador, 7) = Hoja4.Cells(i4 + D_ Proy, 7 + Itipo_de_proyecto * 3) Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i4 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) If Hoja4.Cells(i4 + D_Proy, 7 + Itipo_de_proyec to * 3 + 2) <> "" Then Hoja8.Cells(Icontador, 7 + 0 + 2) = CDbl(Ho ja1.Cells(1, 242)) copiar_medicion_desc i4 End If Icontador = Icontador + 1

Mdulo1 - 51 TBase5 = (TBase4 + imarca4) * 100 DBase5 = (DBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

)) = True Then

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Proy, 1

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then imarca5 = imarca5 + 1 Hoja8.Cells(Icontador, 1) = DBa se5 + imarca5 Hoja8.Cells(Icontador, 2) = Hoj a4.Cells(i5 + D_Proy, 2) Hoja8.Cells(Icontador, 7) = Hoj a4.Cells(i5 + D_Proy, 7 + Itipo_de_proyecto * 3) Hoja8.Cells(Icontador, 7 + 1) = Hoja4.Cells(i5 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) If Hoja4.Cells(i5 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then Hoja8.Cells(Icontador, 7 + 0 + 2) = CDbl(Hoja1.Cells(1, 242)) copiar_medicion_desc i5

00 00 en

End If Icontador = Icontador + 1 TBase6 = (TBase5 + imarca5) * 1

DBase6 = (DBase5 + imarca5) * 1

'nueva insercion If TBase6 > 100000000000000# Th Else

Cells(i6 + D_Proy, 1)) = True Then

imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos '**+ If IsNumeric(Hoja4.

If ((99 > (Hoja 4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then imarca6 = i marca6 + 1 Hoja8.Cells (Icontador, 1) = DBase6 + imarca6 Hoja8.Cells (Icontador, 2) = Hoja4.Cells(i6 + D_Proy, 2) Hoja8.Cells (Icontador, 7) = Hoja4.Cells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3) Hoja8.Cells (Icontador, 7 + 1) = Hoja4.Cells(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) lls(i6 + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then ells(Icontador, 7 + 0 + 2) = CDbl(Hoja1.Cells(1, 242)) medicion_desc i6 Icontador + 1

If Hoja4.Ce

Hoja8.C

copiar_

End If Icontador = End If End If '*** i6 = i6 + 1

Loop End If

Mdulo1 - 52 End If End If i5 = i5 + 1

Loop End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If i0 = i0 + 1 Loop Hoja4.Activate

End Sub Public Sub pegar_conceptos(ByVal Lii As Double, ByVal Liii As Double, Ihasta As Integer) 'Lii contiene el codigo que se pega del 1 al 99 partidas/capitulos 'Liii contiene en que fila se quiere que se pege y luego se le aade la Base Dim j As Integer Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5, imarca6 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim DBase0, DBase1, DBase2, DBase3 As Double Dim DBase4, DBase5, DBase6 As Double Dim Li As Long Dim Stemp As String Dim Icontador As Integer i0 = 1 Icontador = Ipuntos + 1 imarca0 = 0 TBase0 = Base Hoja4.Activate Do While i0 <= Ihasta If IsNumeric(Hoja8.Cells(i0, 1)) = True Then If CDbl(Hoja8.Cells(i0, 1)) = Lii Then Hoja4.Cells(Icontador Hoja4.Cells(Icontador Hoja4.Cells(Icontador Hoja4.Cells(Icontador + + + + D_Proy, D_Proy, D_Proy, D_Proy, 1) = (TBase0 + Liii) 2) = Hoja8.Cells(i0, 2) 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i0, 7) 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i0, 7 + 1)

If Hoja8.Cells(i0, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i0) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp End If

Mdulo1 - 53 Icontador = Icontador + 1 imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (Lii) * 100 DBase1 = (TBase0 + Liii) * 100 If DBase1 > 100000000000000# Then 'Exit Sub Else

, 7 + 1)

Do While i1 <= Ihasta If IsNumeric(Hoja8.Cells(i1, 1)) = True Then If (99 > (Hoja8.Cells(i1, 1) - TBase1) And (Hoja8.Cells(i1, 1) - TBase1) > 0) Then imarca1 = imarca1 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase1 + imarca1 Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i1, 2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i1, 7) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i1

= Stemp

If Hoja8.Cells(i1, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i1) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal End If Icontador = Icontador + 1 TBase2 = (TBase1 + imarca1) * 100 DBase2 = (DBase1 + imarca1) * 100 If DBase2 > 100000000000000# Then Else

e2)) > 0 Then

imarca2 = 0 i2 = 1 Do While i2 <= Ihasta If IsNumeric(Hoja8.Cells(i2, 1)) = True Then If (99 > (Hoja8.Cells(i2, 1) - TBase2)) And ((Hoja8.Cells(i2, 1) - TBas

Cells(i2, 7) ja8.Cells(i2, 7 + 1)

imarca2 = imarca2 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase2 + imarca2 Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i2, 2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Ho

FormulaLocal = Stemp

If Hoja8.Cells(i2, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2). End If Icontador = Icontador + 1 TBase3 = (TBase2 + imarca2) * 100 DBase3 = (DBase2 + imarca2) * 100 If DBase3 > 100000000000000# Then Else

i3, 1) - TBase3) > 0)) Then

imarca3 = 0 i3 = 1 Do While i3 <= Ihasta If IsNumeric(Hoja8.Cells(i3, 1)) = True Then If ((99 > (Hoja8.Cells(i3, 1) - TBase3)) And ((Hoja8.Cells(

3) = Hoja8.Cells(i3, 7) 3 + 1) = Hoja8.Cells(i3, 7 + 1)

imarca3 = imarca3 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase3 + imarca3 Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i3, 2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto *

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto *

to * 3 + 2).FormulaLocal = Stemp

If Hoja8.Cells(i3, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i3) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyec End If Icontador = Icontador + 1 TBase4 = (TBase3 + imarca3) * 100 DBase4 = (DBase3 + imarca3) * 100

Mdulo1 - 54 If DBase4 > 100000000000000# Then Else imarca4 = 0

oja8.Cells(i4, 1) - TBase4)) > 0 Then + imarca4 Cells(i4, 2) e_proyecto * 3) = Hoja8.Cells(i4, 7) e_proyecto * 3 + 1) = Hoja8.Cells(i4, 7 + 1)

i4 = 1 Do While i4 <= Ihasta If IsNumeric(Hoja8.Cells(i4, 1)) = True Then If (99 > (Hoja8.Cells(i4, 1) - TBase4)) And ((H

imarca4 = imarca4 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase4

Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_d

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_d

po_de_proyecto * 3 + 2).FormulaLocal = Stemp

If Hoja8.Cells(i4, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i4) Hoja4.Cells(Icontador + D_Proy, 7 + Iti End If Icontador = Icontador + 1 TBase5 = (TBase4 + imarca4) * 100 DBase5 = (DBase4 + imarca4) * 100 If DBase5 > 100000000000000# Then Else imarca5 = 0 i5 = 1 Do While i5 <= Ihasta If IsNumeric(Hoja8.Cells(i5, 1)) =

True Then TBase5)) And ((Hoja8.Cells(i5, 1) - TBase5) > 0)) Then roy, 1) = DBase5 + imarca5 roy, 2) = Hoja8.Cells(i5, 2) roy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i5, 7) roy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i5, 7 + 1) > "" Then desc(i5) D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp

If ((99 > (Hoja8.Cells(i5, 1) -

imarca5 = imarca5 + 1 Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

If Hoja8.Cells(i5, 7 + 2) <

Stemp = pegar_medicion_

Hoja4.Cells(Icontador +

* 100 * 100 # Then

End If Icontador = Icontador + 1 TBase6 = (TBase5 + imarca5)

DBase6 = (DBase5 + imarca5)

If DBase6 > 100000000000000 Else

Cells(i6, 1)) = True Then 8.Cells(i6, 1) - TBase6)) And ((Hoja8.Cells(i6, 1) - TBase6) > 0)) Then marca6 + 1 (Icontador + D_Proy, 1) = DBase6 + imarca6 (Icontador + D_Proy, 2) = Hoja8.Cells(i6, 2)

i6 = 1 Do While i6 <= Ihasta If IsNumeric(Hoja8.

If ((99 > (Hoja

imarca6 = i

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

Mdulo1 - 55 (Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i6, 7) (Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i6, 7 + 1) lls(i6, 7 + 2) <> "" Then pegar_medicion_desc(i6) ells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp Icontador + 1 rcion

Hoja4.Cells

If Hoja8.Ce

Stemp =

Hoja4.C

End If Icontador =

'nueva inse End If End If i6 = i6 + 1

blemas

Loop '**** End If 'cuidado este da pro End If End If i5 = i5 + 1

Loop

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1

Loop 'i0 = Ipuntos + 1 ' para salir del bucle End If Exit Do 'CUIDADO CON ESTO End If End If i0 = i0 + 1 Loop Hoja4.Activate j = 0 Do While IsEmpty(Hoja4.Cells(j + 1 + D_Proy, 1)) = False j = j + 1 Loop Ipuntos = j End Sub Public Sub pegar_conceptos_bis(ByVal Lii As Double, ByVal Liii As Double) 'Lii contiene el codigo que se pega del 1 al 99 partidas/capitulos 'Liii contiene en que fila se quiere que se pege y luego se le aade la Base Dim j As Integer

Mdulo1 - 56 Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim i0, i1, i2, i3 As Long i4, i5, i6 As Long imarca0, imarca1, imarca2 As Long imarca3, imarca4, imarca5, imarca6 As Long TBase0, TBase1, TBase2, TBase3 As Double TBase4, TBase5, TBase6 As Double DBase0, DBase1, DBase2, DBase3 As Double DBase4, DBase5, DBase6 As Double Li As Long Stemp As String Icontador As Integer

i0 = 1 Icontador = Ipuntos + 1 imarca0 = 0 TBase0 = Base 'Base_copia = (Base + Lii - 1) Hoja4.Activate Do While i0 <= Ipuntos If IsNumeric(Hoja8.Cells(i0, 1)) = True Then If CDbl(Hoja8.Cells(i0, 1)) = Lii Then

Hoja4.Cells(Icontador + D_Proy, 1) = (TBase0 + Liii) Hoja4.Cells(Icontador + D_Proy_bis, 1) = (TBase0 + Liii) Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i0, 2) Hoja4.Cells(Icontador + D_Proy_bis, 2) = Hoja8.Cells(i0, 2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i0, 7) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i0, 7) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i0, 7 + 1) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i0, 7 + 1) If Hoja8.Cells(i0, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i0) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp Stemp = pegar_medicion_desc(i0) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp End If Icontador = Icontador + 1 imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (Lii) * 100 DBase1 = (TBase0 + Liii) * 100 If DBase1 > 1000000000000# Then ' Exit Sub Else

, 7) , 7 + 1) s(i1, 7 + 1)

Do While i1 <= Ipuntos If IsNumeric(Hoja8.Cells(i1, 1)) = True Then If (99 > (Hoja8.Cells(i1, 1) - TBase1) And (Hoja8.Cells(i1, 1) - TBase1) > 0) Then imarca1 = imarca1 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase1 + imarca1 Hoja4.Cells(Icontador + D_Proy_bis, 1) = DBase1 + imarca1 Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i1, 2) Hoja4.Cells(Icontador + D_Proy_bis, 2) = Hoja8.Cells(i1, 2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i1, 7) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i1

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i1

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cell

= Stemp ocal = Stemp

If Hoja8.Cells(i1, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i1) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal

Stemp = pegar_medicion_desc(i1) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 2).FormulaL End If Icontador = Icontador + 1 TBase2 = (TBase1 + imarca1) * 100 DBase2 = (DBase1 + imarca1) * 100 If DBase2 > 1000000000000# Then Else

Mdulo1 - 57

e2)) > 0 Then

imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja8.Cells(i2, 1)) = True Then If (99 > (Hoja8.Cells(i2, 1) - TBase2)) And ((Hoja8.Cells(i2, 1) - TBas imarca2 = imarca2 + 1 Hoja4.Cells(Icontador Hoja4.Cells(Icontador Hoja4.Cells(Icontador Hoja4.Cells(Icontador Hoja4.Cells(Icontador + + + + +

Cells(i2, 7) ja8.Cells(i2, 7) ja8.Cells(i2, 7 + 1) = Hoja8.Cells(i2, 7 + 1)

D_Proy, 1) = DBase2 + imarca2 D_Proy_bis, 1) = DBase2 + imarca2 D_Proy, 2) = Hoja8.Cells(i2, 2) D_Proy_bis, 2) = Hoja8.Cells(i2, 2) D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3) = Ho

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Ho Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 1)

FormulaLocal = Stemp 2).FormulaLocal = Stemp

If Hoja8.Cells(i2, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i2) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).

Stemp = pegar_medicion_desc(i2) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + End If Icontador = Icontador + 1 TBase3 = (TBase2 + imarca2) * 100 DBase3 = (DBase2 + imarca2) * 100 If DBase3 > 1000000000000# Then Else

i3, 1) - TBase3) > 0)) Then

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja8.Cells(i3, 1)) = True Then If ((99 > (Hoja8.Cells(i3, 1) - TBase3)) And ((Hoja8.Cells(

a3 , 2) 3) = Hoja8.Cells(i3, 7) to * 3) = Hoja8.Cells(i3, 7) 3 + 1) = Hoja8.Cells(i3, 7 + 1) to * 3 + 1) = Hoja8.Cells(i3, 7 + 1)

imarca3 = imarca3 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase3 + imarca3 Hoja4.Cells(Icontador + D_Proy_bis, 1) = DBase3 + imarc

Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.Cells(i3, 2) Hoja4.Cells(Icontador + D_Proy_bis, 2) = Hoja8.Cells(i3

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto *

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyec

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyecto *

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_proyec

to * 3 + 2).FormulaLocal = Stemp oyecto * 3 + 2).FormulaLocal = Stemp

If Hoja8.Cells(i3, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i3) Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_de_proyec

Stemp = pegar_medicion_desc(i3) Hoja4.Cells(Icontador + D_Proy_bis, 7 + Itipo_de_pr End If Icontador = Icontador + 1 TBase4 = (TBase3 + imarca3) * 100 DBase4 = (DBase3 + imarca3) * 100 If DBase4 > 1000000000000# Then Else imarca4 = 0 i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja8.Cells(i4, 1)) = True Then

Mdulo1 - 58 oja8.Cells(i4, 1) - TBase4)) > 0 Then + imarca4 ase4 + imarca4 Cells(i4, 2) ja8.Cells(i4, 2) e_proyecto * 3) = Hoja8.Cells(i4, 7) po_de_proyecto * 3) = Hoja8.Cells(i4, 7) e_proyecto * 3 + 1) = Hoja8.Cells(i4, 7 + 1) po_de_proyecto * 3 + 1) = Hoja8.Cells(i4, 7 + 1)

If (99 > (Hoja8.Cells(i4, 1) - TBase4)) And ((H

imarca4 = imarca4 + 1 Hoja4.Cells(Icontador + D_Proy, 1) = DBase4

Hoja4.Cells(Icontador + D_Proy_bis, 1) = DB

Hoja4.Cells(Icontador + D_Proy, 2) = Hoja8.

Hoja4.Cells(Icontador + D_Proy_bis, 2) = Ho

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_d

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Iti

Hoja4.Cells(Icontador + D_Proy, 7 + Itipo_d

Hoja4.Cells(Icontador + D_Proy_bis, 7 + Iti

po_de_proyecto * 3 + 2).FormulaLocal = Stemp Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp

If Hoja8.Cells(i4, 7 + 2) <> "" Then Stemp = pegar_medicion_desc(i4) Hoja4.Cells(Icontador + D_Proy, 7 + Iti

Stemp = pegar_medicion_desc(i4) Hoja4.Cells(Icontador + D_Proy_bis, 7 + End If Icontador = Icontador + 1 TBase5 = (TBase4 + imarca4) * 100 DBase5 = (DBase4 + imarca4) * 100 If DBase5 > 1000000000000# Then Else imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja8.Cells(i5, 1)) =

True Then TBase5)) And ((Hoja8.Cells(i5, 1) - TBase5) > 0)) Then roy, 1) = DBase5 + imarca5 roy_bis, 1) = DBase5 + imarca5 roy, 2) = Hoja8.Cells(i5, 2) roy_bis, 2) = Hoja8.Cells(i5, 2) roy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i5, 7) roy_bis, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i5, 7) roy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i5, 7 + 1)

If ((99 > (Hoja8.Cells(i5, 1) -

imarca5 = imarca5 + 1 Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

Hoja4.Cells(Icontador + D_P

roy_bis, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i5, 7 + 1) > "" Then desc(i5) D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp desc(i5) D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp

Hoja4.Cells(Icontador + D_P

If Hoja8.Cells(i5, 7 + 2) <

Stemp = pegar_medicion_

Hoja4.Cells(Icontador +

Stemp = pegar_medicion_

Hoja4.Cells(Icontador +

* 100 * 100 # Then

End If Icontador = Icontador + 1 TBase6 = (TBase5 + imarca5)

DBase6 = (DBase5 + imarca5)

If DBase6 > 100000000000000

Mdulo1 - 59 Else

Cells(i6, 1)) = True Then 8.Cells(i6, 1) - TBase6)) And ((Hoja8.Cells(i6, 1) - TBase6) > 0)) Then marca6 + 1 (Icontador + D_Proy, 1) = DBase6 + imarca6 (Icontador + D_Proy_bis, 1) = DBase6 + imarca6 (Icontador + D_Proy, 2) = Hoja8.Cells(i6, 2) (Icontador + D_Proy_bis, 2) = Hoja8.Cells(i6, 2) (Icontador + D_Proy, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i6, 7) (Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3) = Hoja8.Cells(i6, 7) (Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i6, 7 + 1)

imarca6 = 0 i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja8.

If ((99 > (Hoja

imarca6 = i

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

Hoja4.Cells

(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 1) = Hoja8.Cells(i6, 7 + 1) lls(i6, 7 + 2) <> "" Then pegar_medicion_desc(i6) ells(Icontador + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp pegar_medicion_desc(i6) ells(Icontador + D_Proy_bis, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = Stemp Icontador + 1

Hoja4.Cells

If Hoja8.Ce

Stemp =

Hoja4.C

Stemp =

Hoja4.C

End If Icontador = End If End If

Loop

Loop End If 'Hasta aqui End If End If i5 = i5 + 1

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1

Mdulo1 - 60 Loop 'i0 = Ipuntos + 1 ' para salir del bucle End If 'nuevo Exit Do End If End If i0 = i0 + 1 Loop Hoja4.Activate j = 0 Do While IsEmpty(Hoja4.Cells(j + 1 + D_Proy, 1)) = False j = j + 1 Loop Ipuntos = j End Sub Public Sub inicializar_arch_temp() Hoja8.Activate Base_copia = 0 num_reg_copia = 0 Cells.ClearContents Hoja4.Activate End Sub Public Sub crearhueco_pegar_bis(ByVal Li As Integer) 'sirve para crear un hueco antes de pegar Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double Dim Stemp As String Li = Li - 1 i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If ((99 - Li) > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) + 1 Hoja4.Cells(i0 + D_Proy_bis, 1) = Hoja4.Cells(i0 + D_Proy_bis, 1) + 1 Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) & "check" imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100

If TBase1 > 100000000000000# Then Exit Sub Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBas e1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) + 100 Hoja4.Cells(i1 + D_Proy_bis, 1) = Hoja4.Cells(i1 + D_Proy_bis, 1) + 100 Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) & "check" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True Then

Mdulo1 - 61

If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) And ((Hoja4.Cells(i2 + D_P roy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) + 10000 Hoja4.Cells(i2 + D_Proy_bis, 1) = Hoja4.Cells(i2 + D_Proy_bis, 1) + 100 00 Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 + D_Proy, 1) & "check" imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.C ells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) + 1000000 Hoja4.Cells(i3 + D_Proy_bis, 1) = Hoja4.Cells(i3 + D_Proy_b is, 1) + 1000000 Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) & "check" imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else imarca4 = 0

en

i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = True Th

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) An d ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 + D_Proy, 1) + 100000000 Hoja4.Cells(i4 + D_Proy_bis, 1) = Hoja4.Cells(i 4 + D_Proy_bis, 1) + 100000000 Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 + D_Proy, 1) & "check" imarca4 = imarca4 + 1 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

)) = True Then

imarca5 = 0 'aqui i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Proy, 1

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy_bis, 1) = H oja4.Cells(i5 + D_Proy_bis, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) & "check" imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

+ D_Proy, 1)) = True Then

i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cells(i6

If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then

Mdulo1 - 62 , 1) = Hoja4.Cells(i6 + D_Proy, 1) + 1000000000000# _bis, 1) = Hoja4.Cells(i6 + D_Proy_bis, 1) + 1000000000000# , 1) = Hoja4.Cells(i6 + D_Proy, 1) & "check"

Hoja4.Cells(i6 + D_Proy

Hoja4.Cells(i6 + D_Proy

Hoja4.Cells(i6 + D_Proy End If End If i6 = i6 + 1

Loop End If End If End If i5 = i5 + 1

Loop

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If i0 = i0 + 1 Loop i1 = 1 Do While i1 <= Ipuntos

If Strings.Right(Hoja4.Cells(i1 + D_Proy, 1), 5) = "check" Then i2 = Len(Hoja4.Cells(i1 + D_Proy, 1)) - 5 Stemp = Strings.Left(Hoja4.Cells(i1 + D_Proy, 1), i2) Hoja4.Cells(i1 + D_Proy, 1) = Stemp Hoja4.Cells(i1 + D_Proy_bis, 1) = Stemp End If i1 = i1 + 1

Loop

End Sub Public Sub crearhueco_pegar(ByVal Li As Integer) 'sirve para crear un hueco antes de pegar Dim i0, i1, i2, i3 As Long Dim i4, i5, i6 As Long Dim imarca0, imarca1, imarca2 As Long Dim imarca3, imarca4, imarca5 As Long Dim TBase0, TBase1, TBase2, TBase3 As Double Dim TBase4, TBase5, TBase6 As Double

Mdulo1 - 63 Dim Stemp As String Li = Li - 1 i0 = 1 imarca0 = Li TBase0 = Base Do While i0 <= Ipuntos If IsNumeric(Hoja4.Cells(i0 + D_Proy, 1)) = True Then If ((99 - Li) > (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) And (Hoja4.Cells(i0 + D_Proy, 1) - (TBase0 + Li)) > 0) Then Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) + 1 Hoja4.Cells(i0 + D_Proy, 1) = Hoja4.Cells(i0 + D_Proy, 1) & "check" imarca0 = imarca0 + 1 i1 = 1 imarca1 = 0 TBase1 = (TBase0 + imarca0) * 100

If TBase1 > 100000000000000# Then Exit Sub Do While i1 <= Ipuntos If IsNumeric(Hoja4.Cells(i1 + D_Proy, 1)) = True Then If (99 > (Hoja4.Cells(i1 + D_Proy, 1) - TBase1) And (Hoja4.Cells(i1 + D_Proy, 1) - TBas e1) > 0) Then Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) + 100 Hoja4.Cells(i1 + D_Proy, 1) = Hoja4.Cells(i1 + D_Proy, 1) & "check" imarca1 = imarca1 + 1 TBase2 = (TBase1 + imarca1) * 100 If TBase2 > 100000000000000# Then Else imarca2 = 0 i2 = 1 Do While i2 <= Ipuntos If IsNumeric(Hoja4.Cells(i2 + D_Proy, 1)) = True If (99 > (Hoja4.Cells(i2 + D_Proy, 1) - TBase2)) roy, 1) - TBase2)) > 0 Then Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 Hoja4.Cells(i2 + D_Proy, 1) = Hoja4.Cells(i2 imarca2 = imarca2 + 1 TBase3 = (TBase2 + imarca2) * 100 If TBase3 > 100000000000000# Then Else

Then And ((Hoja4.Cells(i2 + D_P + D_Proy, 1) + 10000 + D_Proy, 1) & "check"

imarca3 = 0 i3 = 1 Do While i3 <= Ipuntos If IsNumeric(Hoja4.Cells(i3 + D_Proy, 1)) = True Then If ((99 > (Hoja4.Cells(i3 + D_Proy, 1) - TBase3)) And ((Hoja4.C ells(i3 + D_Proy, 1) - TBase3) > 0)) Then Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) + 1000000 Hoja4.Cells(i3 + D_Proy, 1) = Hoja4.Cells(i3 + D_Proy, 1) & "check" imarca3 = imarca3 + 1 TBase4 = (TBase3 + imarca3) * 100 If TBase4 > 100000000000000# Then Else imarca4 = 0

en

i4 = 1 Do While i4 <= Ipuntos If IsNumeric(Hoja4.Cells(i4 + D_Proy, 1)) = True Th

If (99 > (Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) An d ((Hoja4.Cells(i4 + D_Proy, 1) - TBase4)) > 0 Then Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 + D_Proy, 1) + 100000000 Hoja4.Cells(i4 + D_Proy, 1) = Hoja4.Cells(i4 + D_Proy, 1) & "check" imarca4 = imarca4 + 1

Mdulo1 - 64 TBase5 = (TBase4 + imarca4) * 100 If TBase5 > 100000000000000# Then Else

)) = True Then

imarca5 = 0 i5 = 1 Do While i5 <= Ipuntos If IsNumeric(Hoja4.Cells(i5 + D_Proy, 1

If ((99 > (Hoja4.Cells(i5 + D_Proy, 1) - TBase5)) And ((Hoja4.Cells(i5 + D_Proy, 1) - TBase5) > 0)) Then Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) + 10000000000# Hoja4.Cells(i5 + D_Proy, 1) = Hoja4 .Cells(i5 + D_Proy, 1) & "check" imarca5 = imarca5 + 1 TBase6 = (TBase5 + imarca5) * 100 If TBase6 > 100000000000000# Then Else

If ((99 > (Hoja4.Cells(i6 + D_Proy, 1) - TBase6)) And ((Hoja4.Cells(i6 + D_Proy, 1) - TBase6) > 0)) Then Hoja4.Cells(i6 + D_Proy , 1) = Hoja4.Cells(i6 + D_Proy, 1) + 1000000000000# Hoja4.Cells(i6 + D_Proy , 1) = Hoja4.Cells(i6 + D_Proy, 1) & "check" End If End If i6 = i6 + 1

+ D_Proy, 1)) = True Then

i6 = 1 Do While i6 <= Ipuntos If IsNumeric(Hoja4.Cells(i6

Loop

Loop 'hasta aqui End If 'cuidado aqui End If End If i5 = i5 + 1

End If End If End If i4 = i4 + 1 Loop End If 'final insercion End If End If i3 = i3 + 1

Loop End If End If End If i2 = i2 + 1 Loop End If End If End If i1 = i1 + 1 Loop End If End If i0 = i0 + 1

Mdulo1 - 65 Loop i1 = 1 Do While i1 <= Ipuntos If Strings.Right(Hoja4.Cells(i1 + D_Proy, 1), 5) = "check" Then i2 = Len(Hoja4.Cells(i1 + D_Proy, 1)) - 5 Stemp = Strings.Left(Hoja4.Cells(i1 + D_Proy, 1), i2) Hoja4.Cells(i1 + D_Proy, 1) = Stemp End If i1 = i1 + 1

Loop

End Sub Public Sub analizarportapapeles() Dim i, j As Integer Dim CurrentCell As Range Dim NextCell As Range Hoja8.Activate If num_reg_copia = 0 Then 'MsgBox "EL BUFFER ESTA VACIO" inicializar_arch_temp Else Set CurrentCell = Hoja8.Cells(1, 1) While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(1, 0) For i = 1 To IConceptos If Hoja4.Cells(i + ipuntero + 1, 1) = CurrentCell.Offset(0, 1).Value Then Exit For End If Next i If Hoja4.Cells(i + ipuntero + 1, 4) = "C" Then inicializar_arch_temp 'MsgBox "HAY CAPITULOS" Exit Sub End If Set CurrentCell = NextCell Wend 'MsgBox "NO HAY CAPITULOS" Range("R1:HX1").ClearContents Set CurrentCell = Hoja8.Cells(1, 1) j = 1 While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(1, 0) Hoja8.Cells(1, 18 + 3 * (j - 1)) = CurrentCell.Offset(0, 1).Value Hoja8.Cells(1, 18 + 3 * (j - 1) + 1) = 0 j = j + 1 Set CurrentCell = NextCell

Wend Hoja8.Cells(1, 17) = "trans" 'quiere decir que es una transformada y que procede de una copia d el editor de jerarqua End If End Sub Public Sub analizarportapapeles2() 'Es el opuesto de analizaportapapeles. Se encarga de convertir el portapapeles de descompuestos 'al buffer del portapapeles del editor de capitulos y subcapitulos Dim i, j As Integer Dim CurrentCell As Range Dim NextCell As Range

Mdulo1 - 66 Hoja8.Activate If num_reg_copia = 0 Then 'MsgBox "EL BUFFER ESTA VACIO" inicializar_arch_temp ElseIf Hoja8.Cells(1, 17) = "trans" Then 'MsgBox "SE HA RECUPERADO LA SITUACION" Else Set CurrentCell = Hoja8.Cells(1, 18) j = 1 While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(0, 3) Hoja8.Cells(1 + (j - 1), 1) = j Hoja8.Cells(1 + (j - 1), 2) = CurrentCell.Value 'Hoja8.Cells(1, 2 + 2 * (j - 1) + 1) = 0 j = j + 1 Set CurrentCell = NextCell

Wend

Columns("H:I").ClearContents Range("R1:HX1").ClearContents 'MsgBox "SE HA TRAMITADO EL BUFFER" End If End Sub Public Sub eliminar_medicion_desc(ByVal Li As Integer) 'Se encarga de eliminar la medicin descompuesta Dim Dtemp2 As Double Dim stemp1 As String Dim Stemp2 As String Dim Celda1, Celda4 As Range Hoja4.Activate '** stemp1 = Hoja4.Cells(Li, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal Hoja4.Cells(Li, 7 + Itipo_de_proyecto * 3 + 2) = "" '**** stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Hoja1.Activate Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp Hoja4.Activate End Sub Public Sub eliminar_todaslas_medicion_desc(ByVal Li As Integer) 'Se encarga de eliminar la medicin descompuesta incluida producciones y certificaciones Dim Dtemp2 As Double Dim stemp1 As String Dim Stemp2 As String Dim Celda1, Celda4 As Range '* Dim Di As Integer Di = 0 'tieneproduccion = False

Mdulo1 - 67 If trabajo_en_paralelo = False Then For Di = 0 To 81 If Hoja4.Cells(Li, 7 + Di * 3 + 2) <> "" Then Hoja4.Activate '** stemp1 = Hoja4.Cells(Li, 7 + Di * 3 + 2).FormulaLocal Hoja4.Cells(Li, 7 + Di * 3 + 2) = "" '**** stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Hoja1.Activate Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp Hoja4.Activate End If Next Di Else For Di = 0 To 81 If Hoja4.Cells(Li, 7 + Di * 3 + 2) <> "" Then Hoja4.Activate '** stemp1 = Hoja4.Cells(Li, 7 + Di * 3 + 2).FormulaLocal Hoja4.Cells(Li, 7 + Di * 3 + 2) = "" '**** stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Hoja1.Activate Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp Hoja4.Activate End If Next Di For Di = 0 To 81 ' If Hoja4.Cells(Li + D_Proy_bis - D_Proy, 7 + Di * 3 + 2) <> "" Then Hoja4.Activate '** stemp1 = Hoja4.Cells(Li + D_Proy_bis - D_Proy, 7 + Di * 3 + 2).FormulaLocal Hoja4.Cells(Li + D_Proy_bis - D_Proy, 7 + Di * 3 + 2) = "" '**** stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Hoja1.Activate Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp Hoja4.Activate End If Next Di End If '*

Mdulo1 - 68 End Sub Public Sub eliminar_medicion_desc_partida(ByVal Li As Integer) 'Se encarga de eliminar la medicin descompuesta incluida producciones y certificaciones Dim Dtemp2 As Double Dim stemp1 As String Dim Stemp2 As String Dim Celda1, Celda4 As Range '* Dim Di As Integer Di = 0 For Di = 0 To 81 If Hoja4.Cells(Li, 7 + Di * 3 + 2) <> "" Then Hoja4.Activate '** stemp1 = Hoja4.Cells(Li, 7 + Di * 3 + 2).FormulaLocal Hoja4.Cells(Li, 7 + Di * 3 + 2) = "" '**** stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Hoja1.Activate Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp Hoja4.Activate End If Next Di

End Sub Public Function comprobar_insert_auxiliar(ByVal S_codg As String) As Integer 'esta funcion comprueba que el codigo descendiente y el superior es correcto 'ES DECIR BUSCA CONSANGUENEIDAD Dim j As Integer 'Dim Dtemp As Double Dim i0, i1, i2, i3 As Integer Dim k1, k2, k3 As Integer Dim j0, j1, j2 As Integer Dim S_relacion_cod_2(0 To 50) As String Dim S_relacion_cod_3(0 To 50) As String Dim S_relacion_cod(0 To 50) As String 'contiene los cdigos de los descendientes Dim S_relacion_cod_b(0 To 50) As String 'contiene los cdigos de los padres Dim Icontador_3 As Integer Dim Icontador_2 As Integer Dim Icontador As Integer 'contador/puntero de los descendientes Dim Icontadorb As Integer 'contador/puntero de los padres Dim Scelda_0 As String 'Icontadorb = 0 i0 = 1 Icontador = 0 comprobar_insert_auxiliar = 0 'bien Hoja4.Activate For i0 = 1 To IConceptos If Hoja4.Cells(i0 + ipuntero + 1, 1) = Strings.Trim(S_codg) Then Exit For End If Next i0 '

Mdulo1 - 69 S_relacion_cod(0) = S_codg Icontador = Icontador + 1 If i0 <= IConceptos Then 'Es un codigo de partida existente, si es asi se estudia los cdigos descendientes

j0 = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" And Strings.Trim(Hoja4.Cells(i0 + i puntero + 1, 8)) = "P" If Level + 1 >= 4 Then comprobar_insert_auxiliar = 1 'salimos por debajo MsgBox "No se permiten ms de tres niveles de descompuestos!!!" Exit Function End If Scelda_0 = Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) S_relacion_cod(Icontador) = Scelda_0 Icontador = Icontador + 1 For i1 = 1 To IConceptos If Hoja4.Cells(i1 + ipuntero + 1, 1) = Strings.Trim(Scelda_0) Then

Exit For End If Next i1 j1 = 0 Do While Hoja4.Cells(i1 + ipuntero + 1, 100 + j1 * 4) <> "" And Strings.Trim(Hoja4.Cells(i1 + ipuntero + 1, 8)) = "P" If Level + 2 >= 4 Then comprobar_insert_auxiliar = 1 'salimos por debajo MsgBox "No se permiten ms de tres niveles de descompuestos!!!" Exit Function End If Scelda_0 = Hoja4.Cells(i1 + ipuntero + 1, 100 + j1 * 4) S_relacion_cod(Icontador) = Scelda_0 Icontador = Icontador + 1 For i2 = 1 To IConceptos If Hoja4.Cells(i2 + ipuntero + 1, 1) = Strings.Trim(Scelda_0) Then

Exit For End If Next i2 j2 = 0 Do While Hoja4.Cells(i2 + ipuntero + 1, 100 + j2 * 4) <> "" And Strings.Trim(Hoja4.Cell s(i2 + ipuntero + 1, 8)) = "P" If Level + 3 >= 4 Then comprobar_insert_auxiliar = 1 'salimos por debajo MsgBox "No se permiten ms de tres niveles de descompuestos!!!" Exit Function End If Scelda_0 = Hoja4.Cells(i2 + ipuntero + 1, 100 + j2 * 4) S_relacion_cod(Icontador) = Scelda_0 Icontador = Icontador + 1 For i3 = 1 To IConceptos If Hoja4.Cells(i3 + ipuntero + 1, 1) = Strings.Trim(Scelda_0) Then Exit For End If Next i3 Loop j2 = j2 + 1

Loop Loop

'*** j1 = j1 + 1

j0 = j0 + 1

End If 'Aqui la parte en la que buscamos los padres (a partir de posicionconcepto) 'Partida--3 Bucle-->Abuelo----2 Bucle--->Padre----1 Bucle---->Hijo(Podemos estar aqui) 'los codigos se almacenan en S_relacion_cod_b(i) S_relacion_cod_b(0) = Hoja4.Cells(posicionconcepto, 1)

Mdulo1 - 70 Icontadorb = 1

Icontador_2 = 1 For i0 = 1 To IConceptos j0 = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" If Hoja4.Cells(posicionconcepto, 1) = Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) Then Scelda_0 = Hoja4.Cells(i0 + ipuntero + 1, 1) S_relacion_cod_b(Icontadorb) = Scelda_0 S_relacion_cod_2(Icontador_2) = Scelda_0 Icontadorb = Icontadorb + 1 Icontador_2 = Icontador_2 + 1 For k1 = 1 To Icontador_2 Icontador_3 = 1 For i1 = 1 To IConceptos j1 = 0 Do While Hoja4.Cells(i1 + ipuntero + 1, 100 + j1 * 4) <> "" If S_relacion_cod_2(k1) = Hoja4.Cells(i1 + ipuntero + 1, 100 + j1 * 4) Then Scelda_0 = Hoja4.Cells(i1 + ipuntero + 1, 1) S_relacion_cod_b(Icontadorb) = Scelda_0 S_relacion_cod_3(Icontador_3) = Scelda_0 Icontadorb = Icontadorb + 1 Icontador_3 = Icontador_3 + 1 For k2 = 1 To Icontador_3 For i2 = 1 To IConceptos j2 = 0 Do While Hoja4.Cells(i2 + ipuntero + 1, 100 + j2 * 4) <> "" If S_relacion_cod_3(k2) = Hoja4.Cells(i2 + ipuntero + 1, 10 0 + j2 * 4) Then Scelda_0 = Hoja4.Cells(i2 + ipuntero + 1, 1) S_relacion_cod_b(Icontadorb) = Scelda_0 Icontadorb = Icontadorb + 1 Exit Do End If j2 = j2 + 1 Loop Next i2 Next k2 Exit Do End If j1 = j1 + 1 Loop Next i1 Next k1 'una vez encontrado el padre nos vamos (da igual que se repita en eldescompuest o) Exit Do End If j0 = j0 + 1 Loop Next i0 For i0 = 0 To Icontadorb - 1 For j0 = 0 To Icontador - 1 If S_relacion_cod(j0) = S_relacion_cod_b(i0) Then MsgBox "Existe relacin circular!!!" comprobar_insert_auxiliar = 2 'salimos por debajo Exit Function End If Next j0 Next i0 End Function Public Sub copiar_medicion_desc(ByVal Li As Integer) 'Se encarga de copiar la medicin descompuesta Dim Dtemp1 As Double Dim Dtemp2 As Double Dim stemp1 As String Dim Stemp2 As String Dim Celda1, Celda4 As Range Dim Celda3 As Range Hoja1.Activate stemp1 = Hoja4.Cells(Li + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal

Mdulo1 - 71 stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Dtemp2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp2 = 0 Then Dtemp2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp2 + 2, 12 + pos_med_col) Dtemp1 = Hoja1.Cells(1, 242) Set Celda3 = Hoja1.Cells(Dtemp1, 241) Hoja1.Range(Celda1, Celda4).Copy Range(Celda3, Celda3) Hoja1.Cells(1, 242) = Dtemp1 + Dtemp2 + 3 Hoja8.Activate End Sub Public Function pegar_medicion_desc(ByVal Li As Integer) As String 'Se encarga de copiar la medicin descompuesta 'a la funcion se le pasa la linea Dim Dtemp1 As Double Dim Dtemp2 As Double Dim Dtemp4 As Double Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Dim Celda1, Celda4 As Range Dim Celda3 As Range Dim i As Integer pegar_medicion_desc = "" Hoja1.Activate Dtemp2 = CDbl(Hoja8.Cells(Li, 7 + 2)) Dtemp1 = Hoja1.Cells(Dtemp2, 241 + 2) If Dtemp1 = 0 Then Dtemp1 = 1 Set Celda1 = Hoja1.Cells(Dtemp2, 241) Set Celda4 = Hoja1.Cells(Dtemp2 + Dtemp1 + 2, 241 + 12) If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vigor) End If Dtemp2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row If Dtemp2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp2 = 8 End If posicionmedicion = Dtemp2 Set Celda3 = Hoja1.Cells(Dtemp2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda3, Celda3) '****************************************************************************** 'SE GENERA LA INFORMACION DEL ENLACE Hoja4.Activate stemp1 = Range(Celda3, Celda3).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) pegar_medicion_desc = stemp1

End Function Public Sub calcular_auxiliares() Dim i0, j0 As Double Dim i1 As Double Dim BCentinela As Boolean Dim Deditartotalimporte As Double Dim Deditarimporte As Double Dim Dtemp As Double '****************************************************************************************** '*

Mdulo1 - 72 '* Se encarga de calcular el precio de las partidas que tienen descompuestos '* la suma de los descompuestos desde los que estan ms abajo '* '****************************************************************************************** Hoja4.Activate 'PRIMERO SE PONE EN LA COLUMNA 4 LA FILA EN LA QUE ESTA EL CONCEPTO DESCOMPUESTO (ESTO EVITA TENER QUE REITERAR 4 VECES LAS BUSQUEDA) 'SUMA DE DESCOMPUESTOS NIVEL 3 (EL MAS INFERIOR) For i0 = 1 To IConceptos j0 = 0 BCentinela = False Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" 'Scelda_0 = Hoja4.Cells(i0 + iPuntero + 1, 100 + j0 * 4) BCentinela = True For i1 = 1 To IConceptos If Hoja4.Cells(i1 + ipuntero + 1, 1) = Strings.Trim(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4)) Then Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 3) = (i1 + ipuntero + 1) Exit For End If Next i1 Loop j0 = j0 + 1

If CDbl(Hoja4.Cells(i0 + ipuntero + 1, 7)) = 3 Then If BCentinela = False Then 'Se deja el precio de la columna 5 'No existe descomposicion luego no se cambia el precio Else j0 = 0 Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" Dtemp = CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 3)) If Hoja4.Cells(Dtemp, 4) = "%" Then Deditarimporte = Deditartotalimporte ElseIf Hoja4.Cells(Dtemp, 5) = "" Then Deditarimporte = 0 Else Deditarimporte = Round(CDbl(Hoja4.Cells(Dtemp, 5)), format_precrec) End If

'Aqui el rendimiento del auxiliar que esta en la misma posicion de posicionconcepto If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1) <> "" Then Deditarimporte = Deditarimporte * Round(CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1)), format_renrec) Deditarimporte = Round(Deditarimporte, format_imprec) Else

Deditarimporte = 0

Loop Hoja4.Cells(i0 + ipuntero + 1, 5) = Deditartotalimporte End If End If Next i0 For i0 = 1 To IConceptos j0 = 0 Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" And CDbl(Hoja4.Cells(i0 + ipuntero + 1, 7)) = 2 Dtemp = CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 3)) If Hoja4.Cells(Dtemp, 4) = "%" Then Deditarimporte = Deditartotalimporte ElseIf Hoja4.Cells(Dtemp, 5) = "" Then Deditarimporte = 0 Else

End If Deditartotalimporte = Deditartotalimporte + Deditarimporte '********************************************************* j0 = j0 + 1

Mdulo1 - 73 Deditarimporte = Round(CDbl(Hoja4.Cells(Dtemp, 5)), format_precrec) End If 'Aqui el rendimiento del auxiliar que esta en la misma posicion de posicionconcepto If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1) <> "" Then Deditarimporte = Deditarimporte * Round(CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1)), format_renrec) Deditarimporte = Round(Deditarimporte, format_imprec) Else

Deditarimporte = 0

End If Deditartotalimporte = Deditartotalimporte + Deditarimporte '********************************************************* j0 = j0 + 1

Loop If Hoja4.Cells(i0 + ipuntero + 1, 100) <> "" And CDbl(Hoja4.Cells(i0 + ipuntero + 1, 7)) = 2 Th en Hoja4.Cells(i0 + ipuntero + 1, 5) = Deditartotalimporte Next i0 'SUMA DE DESCOMPUESTOS NIVEL 1 For i0 = 1 To IConceptos j0 = 0 Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" And CDbl(Hoja4.Cells(i0 + ipuntero + 1, 7)) = 1 Dtemp = CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 3)) If Hoja4.Cells(Dtemp, 4) = "%" Then Deditarimporte = Deditartotalimporte ElseIf Hoja4.Cells(Dtemp, 5) = "" Then Deditarimporte = 0 Else Deditarimporte = Round(CDbl(Hoja4.Cells(Dtemp, 5)), format_precrec) End If 'Aqui el rendimiento del auxiliar que esta en la misma posicion de posicionconcepto If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1) <> "" Then Deditarimporte = Deditarimporte * Round(CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1)), format_renrec) Deditarimporte = Round(Deditarimporte, format_imprec) Else Deditarimporte = 0

End If Deditartotalimporte = Deditartotalimporte + Deditarimporte '********************************************************* j0 = j0 + 1

Loop If Hoja4.Cells(i0 + ipuntero + 1, 100) <> "" And CDbl(Hoja4.Cells(i0 + ipuntero + 1, 7)) = 1 Th en Hoja4.Cells(i0 + ipuntero + 1, 5) = Deditartotalimporte Next i0 'POR ULTIMO ANALISIS DE PARTIDAS For i0 = 1 To IConceptos j0 = 0 Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" And Hoja4.Cells(i0 + ipuntero + 1, 7) = "" Dtemp = CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 3)) If Hoja4.Cells(Dtemp, 4) = "%" Then Deditarimporte = Deditartotalimporte ElseIf Hoja4.Cells(Dtemp, 5) = "" Then Deditarimporte = 0 Else Deditarimporte = Round(CDbl(Hoja4.Cells(Dtemp, 5)), format_precrec) End If 'Aqui el rendimiento del auxiliar que esta en la misma posicion de posicionconcepto

Mdulo1 - 74 If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1) <> "" Then Deditarimporte = Deditarimporte * Round(CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1)), format_renrec) Deditarimporte = Round(Deditarimporte, format_imprec) Else Deditarimporte = 0

End If Deditartotalimporte = Deditartotalimporte + Deditarimporte '********************************************************* j0 = j0 + 1

Loop If Hoja4.Cells(i0 + ipuntero + 1, 100) <> "" And Hoja4.Cells(i0 + ipuntero + 1, 7) = "" Then Ho ja4.Cells(i0 + ipuntero + 1, 5) = Deditartotalimporte Next i0 End Sub Public Sub calcular_auxiliares_2(ByVal Scodigo As String) 'se trata de otro metodo que parte de un cdigo y va subiendo 'corrigiendo precios Dim i0, j0 As Double Dim Dim Dim Dim Dim Dim Dim i, j As Integer Deditartotalimporte As Double Deditarimporte As Double Dtemp As Double d_temp_rend As Double TempCode(1 To 1000) As String Temppuntero As Integer

TempCode(1) = Scodigo For i0 = 2 To 1000 TempCode(i0) = "" Next i0 Temppuntero = 2 Hoja4.Activate i = 1 Do While TempCode(i) <> "" For i0 = 1 To IConceptos j0 = 0 Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) = TempCode(i) Then 'el codigo buscado esta dentro del descompuesto de la partida Deditartotalimporte = 1 For j = 1 To Temppuntero - 1 If TempCode(j) = Hoja4.Cells(i0 + ipuntero + 1, 1) Then Exit For End If Next j If j > (Temppuntero - 1) Then TempCode(Temppuntero) = Hoja4.Cells(i0 + ipuntero + 1, 1) Temppuntero = Temppuntero + 1 End If End If j0 = j0 + 1

Loop j0 = 0 If Deditartotalimporte = 1 Then Deditartotalimporte = 0 Do While Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4) <> "" For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4)) Then Exit For End If Next j Dtemp = j + ipuntero + 1 If Hoja4.Cells(Dtemp, 4) = "%" Then Deditarimporte = Round(Deditartotalimporte)

Mdulo1 - 75 ElseIf Hoja4.Cells(Dtemp, 5) = "" Then Deditarimporte = 0 Else Deditarimporte = Round(CDbl(Hoja4.Cells(Dtemp, 5)), format_precrec) End If

mat_renrec)

'Aqui el rendimiento del auxiliar que esta en la misma posicion de posicionconcepto If Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1) <> "" Then d_temp_rend = Round(CDbl(Hoja4.Cells(i0 + ipuntero + 1, 100 + j0 * 4 + 1)), for Deditarimporte = Round(Deditarimporte * d_temp_rend, format_imprec) Else Deditarimporte = 0

End If Deditartotalimporte = Deditartotalimporte + Deditarimporte '********************************************************* j0 = j0 + 1

Loop If Hoja4.Cells(i0 + ipuntero + 1, 100) <> "" Then Hoja4.Cells(i0 + ipuntero + 1, 5) = D editartotalimporte End If Next i0 i = i + 1 Loop End Sub Public Sub Estado_final() 'SE ENCARGA DE VIGILAR QUE LOS DATOS DE UN EXPEDIENTE NO PISEN OTRO, POR ESO SI SE ACERCA A 'MENOS DE 1000 FILAS SE INSERTAN 1000 FILAS A MODO DE VIGILANCIA Dim i, j, k As Integer Dim inc_esp(1 To 20) As Double Dim intervalo As Double Dim DD_puntero As Double Dim D_numero_puntos As Double Dim D_suma As Double Dim Rdestino As Range Dim Rkey As Range Dim DDCOnceptos As Double Dim nohaypeligro As Boolean Hoja7.Activate Hoja7.Range("B94") = 0 'que siempre se empieze por el proyect If B_volcar_bis = False Then Hoja7.Cells(95, 2) = "" 'se empieza sin edicion en paralelo End If Hoja7.Cells(Itipo_expediente + 97, 4) = Hoja7.Cells(Itipo_expediente + 97, 5) = If trabajo_en_paralelo = True Then Hoja7.Cells(Itipo_expediente2 + 97, Hoja7.Cells(Itipo_expediente2 + 97, End If D_Proy Ipuntos 4) = D_Proy_bis 5) = Ipuntos

k = 1 j = 0 '1.-LOCALIZAMOS LOS EXPEDIENTES ABIERTOS For i = 97 To 115 j = j + CDbl(Hoja7.Cells(i, 2)) If CDbl(Hoja7.Cells(i, 2)) = 1 Then inc_esp(k) = i 'contiene las lneas que estn activadas k = k + 1 End If Next i If j = 1 Or j < 1 Then Exit Sub '2.- COMPROBAMOS QUE HAY MARGEN, SINO HAY MARGEN SE SUMA 1000 A CADA UNO DE LOS ESPACIOS k = j If k > 9 Then intervalo = 500

Mdulo1 - 76 Else intervalo = 1000 End If j = j - 1 i = 1 'inc_esp(i) = 1 nohaypeligro = False Do While j <> 0 DD_puntero = Hoja7.Cells(inc_esp(i), 4) D_numero_puntos = Hoja7.Cells(inc_esp(i), 5) If D_numero_puntos + DD_puntero > Hoja7.Cells(inc_esp(i + 1), 4) - intervalo Then nohaypeligro = True Hoja7.Cells(inc_esp(i + 1), 6) = intervalo End If i = i + 1 j = j - 1

Loop If nohaypeligro = False Then j = k Hoja7.Activate Do While j <> 0

Hoja7.Cells(inc_esp(j), 6) = "" Hoja7.Cells(inc_esp(j), 7) = "" Hoja7.Cells(inc_esp(j), 8) = "" j = j - 1 Loop Exit Sub End If '3.-RECALCULAR LOS PUNTEROS EN SU SITIO DEPENDIENDO DE LOS PROBLEMAS j = k i = 1 D_suma = 0 Do While j <> 0 D_suma = D_suma + Hoja7.Cells(inc_esp(i), 6) Hoja7.Cells(inc_esp(i), 6) = "" Hoja7.Cells(inc_esp(i), 7) = Hoja7.Cells(inc_esp(i), 4) + D_suma i = i + 1 j = j - 1

Loop Hoja4.Activate j = k '4.-COLOCAR LOS DATOS EN SU SITIO 'DESDE ARRIBA HACIA ABAJO, EL PRIMERO NO SE TRAMITA PORQUE SIEMPRE ESTA APUNTANDO AL PRINCIPIO Do While j <> 1 If Hoja7.Cells(inc_esp(j), 4) = Hoja7.Cells(inc_esp(j), 7) Then 'NO SE REALIZA EL TRASLADO SI LOS PUNTEROS MARCAN LO MISMO Else If Hoja7.Cells(inc_esp(j), 5) = "" Or Hoja7.Cells(inc_esp(j), 5) = "0" Then 'NO SE REALIZA TRASLADO SI EL TAMAO DEL EXPEDIENTE ES 0 Else Set Rkey = Hoja4.Cells((Hoja7.Cells(inc_esp(j), 4)) + 1, 1) Rkey.Select DDCOnceptos = ActiveCell.CurrentRegion.Rows.Count Set Rdestino = Hoja4.Cells((Hoja7.Cells(inc_esp(j), 7)) + 1, 1) Range(ActiveCell, ActiveCell.Offset(DDCOnceptos, 255)).Cut Range(Rdestino, Rdestino) End If End If j = j - 1

Loop

'5.-COLOCAR EN SU SITIO LOS PUNTEROS Y DESPUES LIMPIAR EL BUFFER j = k Hoja7.Activate Do While j <> 0

Mdulo1 - 77 Hoja7.Cells(inc_esp(j), 4) = Hoja7.Cells(inc_esp(j), 7) Hoja7.Cells(inc_esp(j), 7) = "" Loop j = j - 1

End Sub Public Function Insertar_expediente() As Integer 'SE ENCARGA DE redistribuir los punteros de todos los expediente 'adems de redistribuir vigila que no se pise informacion Dim i, j, k As Integer Dim inc_esp(1 To 20) As Double Dim intervalo As Double Dim intervalo2 As Double Dim Despacio As Double Dim DD_puntero As Double Dim D_numero_puntos As Double Dim D_suma As Double Dim Rdestino As Range Dim Rkey As Range Dim DDCOnceptos As Double Insertar_expediente = 0 'quiere decir que no da error Hoja7.Activate k = 1 j = 0 D_suma = 0 '1.-LOCALIZAMOS LOS EXPEDIENTES ABIERTOS Y EL ESPACIO DISPONIBLE For i = 97 To 115 j = j + CDbl(Hoja7.Cells(i, 2)) If CDbl(Hoja7.Cells(i, 2)) = 1 Then D_suma = D_suma + CDbl(Hoja7.Cells(i, 5)) inc_esp(k) = i 'contiene las lneas que estn activadas k = k + 1 End If

Next i If j = 1 Then Exit Function '2.- ESTABLECE UNA PRIMERA DISTRIBUCION intervalo = Int(60000 / j) Despacio = (600000 - D_suma) / j If Despacio > 5000 Then intervalo2 = 5000 Else 'If Despacio < 5000 Then intervalo2 = Despacio End If

k = j i = 1 D_suma = 0 Do While j <> 0 Hoja7.Cells(inc_esp(i), 8) = intervalo * (i - 1) i = i + 1 j = j - 1

Loop '3.- COMPROBAMOS QUE HAY MARGEN, SINO HAY MARGEN SE SUMA intervalo2+el espacio solapado A CADA UNO DE LOS ESPACIOS

j = k j = j - 1 i = 1 'inc_esp(i) = 1 Do While j <> 0 DD_puntero = Hoja7.Cells(inc_esp(i), 8) 'la nueva posicion calculada D_numero_puntos = Hoja7.Cells(inc_esp(i), 5) If D_numero_puntos + DD_puntero > Hoja7.Cells(inc_esp(i + 1), 8) Then 'hay peligro de pisar la informacin 'tenemos que sumer 1000 mas a todo Hoja7.Cells(inc_esp(i + 1), 6) = intervalo2 + (D_numero_puntos + DD_puntero) - (Hoja7.Cells (inc_esp(i + 1), 8))

Mdulo1 - 78 End If i = i + 1 j = j - 1

Loop '4.-RECALCULAR LOS PUNTEROS EN SU SITIO DEPENDIENDO DE LOS PROBLEMAS j = k i = 1 D_suma = 0 Do While j <> 0 D_suma = D_suma + Hoja7.Cells(inc_esp(i), 6) Hoja7.Cells(inc_esp(i), 6) = "" Hoja7.Cells(inc_esp(i), 7) = Hoja7.Cells(inc_esp(i), 8) + D_suma If CDbl(Hoja7.Cells(inc_esp(i), 7)) > 60000 Then 'error Insertar_expediente = 1 End If i = i + 1 j = j - 1 Loop If Insertar_expediente = 0 Then Hoja4.Activate j = k 'SE RECOLOCA TODO '5.-COLOCAR LOS DATOS EN SU SITIO 'DESDE ARRIBA HACIA ABAJO, EL PRIMERO NO SE TRAMITA PORQUE SIEMPRE ESTA APUNTANDO AL PRINCIPIO Do While j <> 1 If Hoja7.Cells(inc_esp(j), 5) = "" Or Hoja7.Cells(inc_esp(j), 5) = "0" Then Else Set Rkey = Hoja4.Cells((Hoja7.Cells(inc_esp(j), 4)) + 1, 1) Rkey.Select DDCOnceptos = ActiveCell.CurrentRegion.Rows.Count Set Rdestino = Hoja4.Cells((Hoja7.Cells(inc_esp(j), 7)) + 1, 1) Range(ActiveCell, ActiveCell.Offset(DDCOnceptos, 255)).Cut Range(Rdestino, Rdestino)

Loop

'j = j - 1 End If j = j - 1

'5.-COLOCAR EN SU SITIO LOS PUNTEROS Y DESPUES LIMPIAR EL BUFFER j = k Hoja7.Activate Do While j <> 0 Hoja7.Cells(inc_esp(j), 4) = Hoja7.Cells(inc_esp(j), 7) Hoja7.Cells(inc_esp(j), 7) = "" Hoja7.Cells(inc_esp(j), 8) = "" j = j - 1

Loop Else 'Si ha existido error j = k Hoja7.Activate Do While j <> 0

Loop End If

Hoja7.Cells(inc_esp(j), 7) = "" Hoja7.Cells(inc_esp(j), 8) = "" j = j - 1

End Function Public Function car_raros(ByVal Sceld As String) As Boolean car_raros = True 'If InStr(1, "~T~D~M", Left(a$, 2)) <> 0 Then If InStr(1, Sceld, "~") <> 0 Then MsgBox "No esta permitida la entrada de cdigos especiales como ><*+:;" Exit Function End If

Mdulo1 - 79 If InStr(1, Sceld, "") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "\") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "!") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "|") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "@") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "#") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "$") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "/") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "{") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "}") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "]") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "[") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, ";") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, ":") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, ".") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, ",") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "+") <> 0 Then MsgBox "No esta permitida la entrada Exit Function End If If InStr(1, Sceld, "*") <> 0 Then MsgBox "No esta permitida la entrada Exit Function de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

de cdigos especiales como ><*+:;"

Mdulo1 - 80 End If If InStr(1, Sceld, "<") <> 0 Then MsgBox "No esta permitida la entrada de cdigos especiales como ><*+:;" Exit Function End If If InStr(1, Sceld, ">") <> 0 Then MsgBox "No esta permitida la entrada de cdigos especiales como ><*+:;" Exit Function End If car_raros = False End Function Public Sub List_Head1() Dim DataHead(1 To 1, 1 To 12) Mexcel.ListBox3.ColumnCount = 11 Mexcel.ListBox3.ColumnWidths = "25;20;80;30;180;76;76;76;76;76;30" DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, 1) = "Tipo" 2) = "Inf" 3) = "Cdigo" 4) = "Ud." 5) = "Resumen" 6) = "Medicin" 7) = "Precio" 8) = "Importe" 9) = "Medicin" 10) = "Precio" 11) = "Imp."

Mexcel.ListBox3.List = DataHead End Sub Public Sub List_Head2() Dim DataHead(1 To 1, 1 To 12) Mexcel.ListBox3.ColumnCount = 8 Mexcel.ListBox3.ColumnWidths = "20;20;80;30;180;76;76;76"

DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1,

1) = "Tipo" 2) = "Inf" 3) = "Cdigo" 4) = "Ud." 5) = "Resumen" 6) = "Medicin" 7) = "Precio" 8) = "Importe" 9) = "" 10) = "" 11) = ""

Mexcel.ListBox3.List = DataHead End Sub Public Sub referenciar() 'Se trata de una funcin que coge los presupuestos de los expediente 'pone una C a los capitulos para indicar capitulo y que no busque 'adems asigna una referencia (fila) que contiene el concepto que apunta el presupuesto 'vigila que esa referencia no se pierda 'Ademas buscamos el 0, sino esta lo creamos y avisamos de ordenar de nuevo Dim j As Double, ipoint As Double Dim i As Double Dim D_Proy_temp As Double Dim Ipuntos_temp As Double Dim Stemp As String 'Dim Stemp2 As String Dim Dtemp As Double Dim Bfound As Boolean Dim Rkey As Range On Error Resume Next 'Hoja4.Cells(Icontador + D_Proy, 1) = (TBase0 + Liii) 'Hoja4.Cells(Icontador + D_Proy_bis, 1) = (TBase0 + Liii)

Mdulo1 - 81 'For i = 0 To 18 Bfound = False 'If Hoja7.Cells(97 + i, 2) <> "" Then 'D_Proy_temp = Hoja7.Cells(97 + i, 4) D_Proy_temp = D_Proy Set Rkey = Hoja4.Cells(D_Proy_temp + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos_temp = 0 Else Ipuntos_temp = ActiveCell.CurrentRegion.Rows.Count End If For j = 1 To Ipuntos_temp If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 1)) <> "" Then If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 1)) = "0" Then Bfound = True Else If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 4)) = "" Then If Err = 0 Then Stemp = Strings.Trim(Conversion.Str(j + D_Proy_temp)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" 'Stemp = Stemp + Stemp2 ''=COINCIDIR(B1;$A$60002:$A$60009;0)+60001 Hoja4.Cells(j + D_Proy_temp, 4).FormulaLocal = Stemp Dtemp = CDbl(Hoja4.Cells(j + D_Proy_temp, 4)) If Hoja4.Cells(Dtemp, 4) = "C" Then Hoja4.Cells(j + D_Proy_temp, 3) = "C" End If 'Exit Sub Else 'Hoja4.Cells(j + D_Proy_temp, 4) = "ERROR" Hoja4.Cells(j + D_Proy_temp, 2) = "0_ERROR" End If End If End If Exit For

Else

End If Next j If Bfound = False Then Hoja4.Cells(j + D_Proy_temp, 1) = "0" Hoja4.Cells(j + D_Proy_temp, 2) = "##" 'Stemp = Strings.Trim(Conversion.Str(j + D_Proy_temp)) Stemp = "60000" Hoja4.Cells(j + D_Proy_temp, 4).FormulaLocal = Stemp Ipuntos_temp = Ipuntos_temp + 1 Hoja7.Cells(97 + i, 5) = Ipuntos_temp End If 'End If 'Next i '********************ahora con el paralelo***************** Bfound = False 'If Hoja7.Cells(97 + i, 2) <> "" Then 'D_Proy_temp = Hoja7.Cells(97 + i, 4) D_Proy_temp = D_Proy_bis Set Rkey = Hoja4.Cells(D_Proy_temp + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos_temp = 0 Else Ipuntos_temp = ActiveCell.CurrentRegion.Rows.Count End If For j = 1 To Ipuntos_temp

Mdulo1 - 82 If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 1)) <> "" Then If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 1)) = "0" Then Bfound = True Else If Strings.Trim(Hoja4.Cells(j + D_Proy_temp, 4)) = "" Then If Err = 0 Then Stemp = Strings.Trim(Conversion.Str(j + D_Proy_temp)) Stemp = "=COINCIDIR(B" + Stemp + ";$A$60001:$A$65535;0)+60000" 'Stemp = Stemp + Stemp2 ''=COINCIDIR(B1;$A$60002:$A$60009;0)+60001 Hoja4.Cells(j + D_Proy_temp, 4).FormulaLocal = Stemp Dtemp = CDbl(Hoja4.Cells(j + D_Proy_temp, 4)) If Hoja4.Cells(Dtemp, 4) = "C" Then Hoja4.Cells(j + D_Proy_temp, 3) = "C" End If 'Exit Sub Else 'Hoja4.Cells(j + D_Proy_temp, 4) = "ERROR" Hoja4.Cells(j + D_Proy_temp, 2) = "0_ERROR" End If End If End If Exit For

Else

End If Next j If Bfound = False Then Hoja4.Cells(j + D_Proy_temp, 1) = "0" Hoja4.Cells(j + D_Proy_temp, 2) = "##" 'Stemp = Strings.Trim(Conversion.Str(j + D_Proy_temp)) Stemp = "60000" Hoja4.Cells(j + D_Proy_temp, 4).FormulaLocal = Stemp Ipuntos_temp = Ipuntos_temp + 1 Hoja7.Cells(97 + i, 5) = Ipuntos_temp End If 'End If 'Next i

End Sub Public Function fijar_base_concepto() As String Dim Rkey As Range Dim Stemp As String Dim Dtemp As Double Hoja4.Activate 'Stemp = "$A$60002:$A$" Stemp = "=COINCIDIR(B1;$A$60002:$A$65535;0)+60001" If IsEmpty(Hoja4.Cells(ipuntero + 2, 1)) Then 'no hay conceptos luego no se ordena y nos vamos Dtemp = 0 fijar_base_concepto = "" Else Set Rkey = Hoja4.Cells(ipuntero + 2, 1) Rkey.Select Dtemp = ActiveCell.CurrentRegion.Rows.Count - 1 Dtemp = 60001 + IConceptos 'Set Rinicio = Hoja4.Cells(ipuntero + 2, 1) Stemp = Stemp + Strings.Trim(Conversion.Str(Dtemp)) fijar_base_concepto = Stemp + ";0)+60001" End If '=COINCIDIR(B1;$A$60002:$A$65535;0)+60001 End Function

Mdulo1 - 83 Sub Macro4() 'ELIMINACION DE REFERENCIAS EN MEDICIONES Dim j As Double Dim Stemp As String Hoja4.Activate ' For j = 1 To 50000 If Strings.Trim(Hoja4.Cells(j, 9)) <> "" Then Stemp = Hoja4.Cells(j, 9).FormulaLocal Stemp = SolamenteRef(Stemp) Hoja4.Cells(j, 10).FormulaLocal = "=Mediciones!" + Stemp '=Mediciones!A15 End If Next j End Sub

Mdulo11 - 1

'**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** '************************************************************************************ '* '* HOJA DE IMPORTACIONES BC3 '* '* '************************************************************************************ '"a materiales" 'Tipo_concepto = 3 '"a mano de obra" 'Tipo_concepto = 1 '"a maquinaria" 'Tipo_concepto = 2 '"a subcontrata" 'Tipo_concepto = 4 '"a partida" 'Tipo_concepto = 5 '"a capitulo" 'Tipo_concepto = 6 '"a auxiliar" 'Tipo_concepto = 7 Public B_import_med As Boolean Public B_import_precdesc As Boolean Public B_ajuste_precdesc As Boolean Public Almacen_codigo(1 To 2000) As String

Public Sub CONVIERTE_BC3() Dim centinela2 As Integer Dim Mensaje As String Dim Estilo As String Dim Ttulo As String Dim Respuesta As String Dim FILETOOPEN As Variant Dim FICHERO As Variant Dim f As String Dim b As String Dim a As String Dim centinela As Long Dim n As Integer 'Dim centinela2 As Long Mensaje = "ESCOGER ARCHIVO *.BC3 PARA CONVERTIR A HOJA DE CALCULO ?" Estilo = vbOKCancel + vbExclamation Ttulo = "CONVERSION FIEBDC-3/95-98 A HOJA DE CALCULO" Respuesta = MsgBox(Mensaje, Estilo, Ttulo) Traduce.Estado.Caption = "Leyendo y procesando archivo" If Respuesta = vbOK Then FILETOOPEN = Application.GetOpenFilename("Archivos Base de Precios (*.BC3), *.BC3") If FILETOOPEN <> False Then Worksheets(1).Activate ' ACTIVAR LA HOJA Worksheets(1).Cells(1, 1).Value = "PROCESANDO FICHERO, ESPERE POR FAVOR........" f$ = Strings.Left(FILETOOPEN, (Len(FILETOOPEN) - 3)) + "TMP" Dim fso Dim file As String Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(f$) Then fso.Deletefile f$, True Else 'MsgBox f$ & " does not exist or has already been deleted!" _ , vbExclamation, "Archivo no encontrado" End If Open FILETOOPEN For Input As #1 Open f$ For Output As #2 'BUCLE DE FILTRADO Line Input #1, a$ centinela = 0 centinela2 = 0

Mdulo11 - 2

While Not EOF(1) If InStr(1, "~T", Strings.Left(a$, 2)) <> 0 Then ' Modificar caracteres MS-DOS para visualizar bajo Windows For n = 1 To Len(a$) b$ = Strings.Mid(a$, n, 1) Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select Mid(a$, n, 1) = b$ Next n Print #2, a$ 'LINEA ESCOGIDA PARA SER PROCESADA POSTERIORMENTE ElseIf InStr(1, "~D", Strings.Left(a$, 2)) <> 0 Then ' Modificar caracteres MS-DOS para visualizar bajo Windows '~D|C02#|02.01#\\1.000\02.02#\\1.000\02.03#\\1.000\| '~D|G01080050|A0111000\\0.045\A0140000\\0.090\M01AD130\\2.000\C131U061\\0.010\C133U001\ \0.018\C133U040\\0.045\C1502D00\\0.005\%CI\\0.060\| '~D|R_A_I_Z##|C01#\\1.000\C02#\\1.000\C03#\\1.000\C04#\\1.000\C06#\\1.000\C07#\\1.000\C 08#\\1.000\C09#\\1.000\C11#\\1.000\| '~C|C01#||MOVIMIENTO DE TIERRAS |80306.96|190209|| 'Ej MENFIS '~D|R_A_I_Z##|1#\\1.00\2#\\1.00\3#\\1.00\4#\\1.00\5#\\1.00\6#\\1.00\7#\\1.00\8#\\1.00\9 #\\1.00\10#\\1.00\11#\\1.00\| '~D|1#|1.1#\\1.00\1.2#\\1.00\| 'Ej PRESTO 'NO LE PONEN EL # A LOS CAPITULOS AUNQUE LOS CONCEPTOS LLEVEN # '~D|R_A_I_Z##|1\1\1\2\1\1\3\1\1\4\1\1\5\1\1\6\1\1\7\1\1\8\1\1\9\1\1\10\1\1\11\1\1\| '~D|1#|1.1\1\1\1.2\1\1\| For n = 1 To Len(a$) b$ = Strings.Mid(a$, n, 1) If b$ = "|" Then centinela = centinela + 1 centinela2 = 0 End If If b$ = "\" Then centinela2 = centinela2 + 1 If centinela2 = 3 Then centinela2 = 0 'se trata de sustituir los puntos por comas decimales, no he encontrado nada mejor If centinela >= 2 And centinela2 = 2 Then Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167

Mdulo11 - 3 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select If b$ = "." Then b$ = ","

Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select End If Mid(a$, n, 1) = b$ Next n Print #2, a$ 'LINEA ESCOGIDA PARA SER PROCESADA POSTERIORMENTE '**** ElseIf InStr(1, "~C", Strings.Left(a$, 2)) <> 0 Then ' Modificar caracteres MS-DOS para visualizar bajo Windows '~C|1#||MOVIMIENTO DE TIERRAS|6828300.311||| '~C|BBMZU004|m|SOP.PERF.ACE.GALV C-120,PARA BARR....|10.71|151198|3| '~C|G30BNN33|ud|APOYO CONFINADO-TEFLON TIPO POT PL-1900|7383.187|271201|| For n = 1 To Len(a$) b$ = Strings.Mid(a$, n, 1) If b$ = "|" Then centinela = centinela + 1 'se trata de sustituir los puntos por comas decimales, no he encontrado nada mejor If centinela = 4 Then Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select If b$ = "." Then b$ = "," Else Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra

Else

Mdulo11 - 4 Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select End If Mid(a$, n, 1) = b$ Next n Print #2, a$ 'LINEA ESCOGIDA PARA SER PROCESADA POSTERIORMENTE '***** ElseIf InStr(1, "~V", Strings.Left(a$, 2)) <> 0 Then '~V||FIEBDC-3/2002\111208|Menfis 6.4.2|\|ANSI| For n = 1 To Len(a$) b$ = Strings.Mid(a$, n, 1) Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select Mid(a$, n, 1) = b$ Next n Print #2, a$ 'LINEA ESCOGIDA PARA SER PROCESADA POSTERIORMENTE

'**** ElseIf InStr(1, "~M", Strings.Left(a$, 2)) <> 0 Then '~M|5.2.1.2.2#\G402NN00|5\2\1\2\2\3|2306.314|\Segn medicin auxiliar\1\2306.314\\\| '~M|1.1#\G1010005|1\1\1|26065.000|\Segn medicin auxiliar\1\26065.000\\\| '~M|3.4.1#\G10A0001|3\4\1\2|4.801|\Segn medicin auxiliar\1\4.801\\\| '~M|R_A_I_Z##\ojala|1|112.53|\en un\1.23\1.11\1.12\9.99\\lugar\1.11\1.11\1.12\9.99\\de la mancha\1.12\1.11\1.12\9.99\\de cuyo\1.15\1.11\1.12\9.99\\nombre\2.22\1.11\1.12\9.99\\no quiero\2 .23\1.11\1.12\9.99\| For n = 1 To Len(a$) b$ = Strings.Mid(a$, n, 1) If b$ = "|" Then centinela = centinela + 1 'se trata de sustituir los puntos por comas decimales, no he encontrado nada mejor If centinela >= 2 Then 'Mal, lo har incluso en el texto auxiliar Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra

Mdulo11 - 5 Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select If b$ = "." Then b$ = ","

Select Case Asc(b$) ' Evala CARACTER. Case 160 b$ = Strings.Chr(225) ' Letra Case 130 b$ = Strings.Chr(233) ' Letra Case 161 b$ = Strings.Chr(237) ' Letra Case 162 b$ = Strings.Chr(243) ' Letra Case 163 b$ = Strings.Chr(250) ' Letra Case 165 b$ = Strings.Chr(209) ' Letra Case 164 b$ = Strings.Chr(241) ' Letra Case 129 b$ = Strings.Chr(252) ' Letra Case 167 b$ = Strings.Chr(186) ' Letra Case 166 b$ = Strings.Chr(170) ' Letra Case Else ' Otros valores. End Select End If Mid(a$, n, 1) = b$ Next n Print #2, a$ 'LINEA ESCOGIDA PARA SER PROCESADA POSTERIORMENTE '*** End If Worksheets(1).Cells(2, 1).Value = a$ Line Input #1, a$ ' LEER SIGUIENTE LINEA HASTA EL FINAL DEL FICHERO centinela = 0 centinela2 = 0 Wend

Else

DOR

Close #1 Close #2 Worksheets(1).Cells(1, 1).Value = "" Worksheets(1).Cells(2, 1).Value = "" 'CONVERSION A HOJA DE CALCULO PARA SU ORDENACION (TENER EN CUENTA EL DELIMITADOR) Workbooks.OpenText FileName:=f$, DataType:=xlDelimited, other:=True, OtherChar:="|" 'DELIMITA

ActiveWorkbook.SaveAs FileName:=Strings.Left(FILETOOPEN, Len(FILETOOPEN) - 3) + "XLS", FileFo rmat:=xlNormal, CreateBackup:=False, Local:=True Set FICHERO = CreateObject("Scripting.FileSystemObject") FICHERO.Deletefile (f$) 'Call FiltraPresto(FILETOOPEN) Call Mexcel(FILETOOPEN) End If End If End Sub

Mdulo11 - 6

Sub Dim 'cm Dim Dim Dim Dim Dim

Mexcel(FILESAVENAME) i, j, k As Integer cm(1 dm(1 em(1 fm(1 gm(1 To To To To To 500) 500) 500) 500) 500) As As As As As String 'para mediciones String String String String

Dim c(1 To 99) As String Dim d(1 To 99) As String Dim e(1 To 99) As String Dim c2(1 To 99) As String Dim D2(1 To 99) As String Dim e2(1 To 99) As String Dim c3(1 To 99) As String Dim D3(1 To 99) As String Dim e3(1 To 99) As String Dim c4(1 To 99) As String Dim D4(1 To 99) As String Dim e4(1 To 99) As String Dim c5(1 To 99) As String Dim D5(1 To 99) As String Dim e5(1 To 99) As String Dim c6(1 To 99) As String Dim D6(1 To 99) As String Dim e6(1 To 99) As String Dim c7(1 To 99) As String Dim D7(1 To 99) As String Dim e7(1 To 99) As String Dim c8(1 To 99) As String Dim d8(1 To 99) As String Dim e8(1 To 99) As String Dim vuelta(1 To 9) As String Dim quedan(1 To 9) As String ' mediante esta variable indican cuantas partidas/niveles quedan Dim ipoint(1 To 9) As Integer Dim Base(1 To 9) As Double Dim Stemp As String Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim m(2 To 9) As Integer m3 As Integer m4 As Integer m5 As Integer ipuntero As Double IConceptos As Double Iestructura As Double Sheetworkb1 As String Sheetworkb2 As String I_puntero As Double saj As String Dtemp1 As Double Dtemp2 As Double Dtemp4 As Double S_temp As String stemp1 As String Stemp2 As String stemp3 As String Celda1, Celda4 As Range Celda3 As Range Rkey As Range Rdestino As Range CurrentCell As Range

Mdulo11 - 7 Dim DDCOnceptos As Double Dim DDDpunt As Double Dim I_numero As Double 'Dim D_med_res As Double 'RemoverPasswordEnHoja 'quitar portecciones hoja4 limpiahojaimportada Sheetworkb1 = ActiveWorkbook.Name ThisWorkbook.Activate Sheetworkb2 = ActiveWorkbook.Name ipuntero = Hoja7.Range("B23") + 2 Windows(Sheetworkb1).Activate Worksheets(1).Activate ' ACTIVAR LA HOJA '**************************************************************************** ' ESTABLECER Y PREPARAR TODOS LOS CONCEPTOS "~C" ' DETERMINAR TODO EL NUMERO DE CONCEPTOS = IConceptos '**************************************************************************** '~C|%CI|%|Costes Indirectos|||%| '~C|A012U001|h|OFICIAL 1A DE TUNEL|14.88|151198|1| mano de obra 1 '~C|B0321000|m3|ZAHORRA SIN CRIBAR|8.2|191104|3| materiales '~C|C131U000|h|PALA CARG.110 HP,TIPO CAT-953 O SI...|34.11|151198|2| maquinaria Traduce.Estado.Caption = "Tramitando Conceptos del Proyecto" IConceptos = 0 Set CurrentCell = Range("A1") While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "~C" Then IConceptos = IConceptos + 1 End If Set CurrentCell = NextCell Wend 'Range("E1").Select Set CurrentCell = Range("E1") CurrentCell.Select Range(ActiveCell, ActiveCell.Offset(IConceptos, 0)).Select Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _ SearchOrder:=xlByColumns, MatchCase:=False '********************************************************************************** Set CurrentCell = Range("A1") I_numero = 1 While (Not IsEmpty(CurrentCell))

Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "~C" Then If InStr(1, CurrentCell.Offset(0, 1).Value, "\") <> 0 Then If Strings.Right(CurrentCell.Offset(0, 1).Value, 1) = "\" Then CurrentCell.Offset(0, 1).Value = Strings.Left(CurrentCell.Offset(0, 1).Value, ( Len(CurrentCell.Offset(0, 1).Value) - 1)) End If End If If InStr(1, CurrentCell.Offset(0, 1).Value, "##") <> 0 Then IConceptos = IConceptos - 1 j = j - 1 ElseIf InStr(1, CurrentCell.Offset(0, 1).Value, "#") <> 0 Then Hoja4.Cells(ipuntero + j, 1).Value = CurrentCell.Offset(0, 1).Value ' EL CODIGO Almacen_codigo(I_numero) = CurrentCell.Offset(0, 1).Value I_numero = I_numero + 1 Hoja4.Cells(ipuntero + j, 2).Value = CurrentCell.Offset(0, 2).Value Hoja4.Cells(ipuntero + j, 3).Value = CurrentCell.Offset(0, 3).Value Hoja4.Cells(ipuntero + j, 4).Value = "C" Hoja4.Cells(ipuntero + j, 8).Value = "1" 'creado en el estado 1 Else 'partidas b$ = CurrentCell.Offset(0, 1).Value 'codigo Hoja4.Cells(ipuntero + j, 1).Value = b$ Hoja4.Cells(ipuntero + j, 8).Value = "1" 'creado en la instancia/estado 1 '**************************************************************** '*DETERMINACION DEL TIPO CONCEPTO POR N

Mdulo11 - 8

'~C|A012U001|h|OFICIAL 1A DE TUNEL|14.88|151198|1| mano de obra 1 '~C|B0321000|m3|ZAHORRA SIN CRIBAR|8.2|191104|3| materiales '~C|C131U000|h|PALA CARG.110 HP,TIPO CAT-953 O SI...|34.11|151198|2| maquinaria b$ = Mid(b$, 1, 1) If InStr(1, CurrentCell.Offset(0, 1).Value, "%") <> 0 Then Hoja4.Cells(ipuntero + j, 4) = "%" Hoja4.Cells(ipuntero + j, 7).Value = "2" 'en partidas quiere decir nivel 1 ElseIf CurrentCell.Offset(0, 6) = "" Then Hoja4.Cells(ipuntero + j, 7).Value = "1" 'en partidas quiere decir nivel 1 Hoja4.Cells(ipuntero + j, 4).Value = "P" ElseIf CurrentCell.Offset(0, 6) = 3 Then Hoja4.Cells(ipuntero + j, 4) = "mat" Hoja4.Cells(ipuntero + j, 7).Value = ElseIf CurrentCell.Offset(0, 6) = 1 Then Hoja4.Cells(ipuntero + j, 4) = "mo" Hoja4.Cells(ipuntero + j, 7).Value = ElseIf CurrentCell.Offset(0, 6) = 2 Then Hoja4.Cells(ipuntero + j, 4) = "maq" Hoja4.Cells(ipuntero + j, 7).Value = 'MATERIALES "2" 'en partidas quiere decir nivel 1 'Mano de Obra "2" 'en partidas quiere decir nivel 1 'Maquinaria "2"

End If '***************************** Hoja4.Cells(ipuntero + j, 2).Value = CurrentCell.Offset(0, 2).Value Hoja4.Cells(ipuntero + j, 3).Value = CurrentCell.Offset(0, 3).Value If InStr(1, CurrentCell.Offset(0, 4).Value, "\") <> 0 Then a$ = CurrentCell.Offset(0, 4).Value b$ = "" c(1) = "" centinela = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then Exit For Else Select Case centinela Case 0 If b$ = "." Then b$ = "," c(1) = c(1) + b$ 'precio

End Select End If Next n If c(1) = "" Then Hoja4.Cells(ipuntero + j, 5).Value = "" ElseIf c(1) = "0" Then Hoja4.Cells(ipuntero + j, 5).Value = "" ' "0" Else Hoja4.Cells(ipuntero + j, 5).Value = CDbl(c(1)) ' el precio

End If Else '******************************************** If CurrentCell.Offset(0, 4) = "" Then Hoja4.Cells(ipuntero + j, 5).Value = "" ElseIf CurrentCell.Offset(0, 4) = 0 Then Hoja4.Cells(ipuntero + j, 5).Value = 0 ElseIf InStr(1, CurrentCell.Offset(0, 4), ".") <> 0 Then Else Hoja4.Cells(ipuntero + j, 5).Value = CurrentCell.Offset(0, 4).Value

Mdulo11 - 9 End If End If

End If j = j + 1 End If Set CurrentCell = NextCell Wend 'SuprimirFilasVacias 'BORRA LAS FILAS VACIAS '**************************************************************************** ' BORRAR LAS "~C" ' '**************************************************************************** Windows(Sheetworkb1).Activate Worksheets(1).Activate j = 1 While (Not IsEmpty(Worksheets(1).Cells(j, 1).Value)) Worksheets(1).Cells(j, 1).Select If Worksheets(1).Cells(j, 1).Value = "~C" Then Selection.EntireRow.Select Selection.Delete Shift:=xlUp Else j = j + 1 End If Wend '**************************************************************************** ' PONER EL TEXTO LARGO EN CADA UNO DE LOS CONCEPTOS "~T" ' ' EL TEXTO SE PONE A PARTIR DE ipuntero '( ADEMAS SE LE PONE UNA BANDERA DE TEXTO AL CODIGO O AL SUBCAPITULO) '**************************************************************************** Traduce.Estado.Caption = "Tramitando el texto de los conceptos" Set CurrentCell = Range("A1") Windows(Sheetworkb2).Activate '"prexcel_44.xls" Hoja4.Activate While (Not IsEmpty(CurrentCell))

Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "~T" Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(CurrentCell.Offset (0, 1).Value) Then Exit For ElseIf Hoja4.Cells(j + ipuntero + 1, 1).Value = CurrentCell.Offset(0, 1).Value Then Exit For End If Next j If InStr(1, CurrentCell.Offset(0, 1).Value, "##") <> 0 Then ElseIf InStr(1, CurrentCell.Offset(0, 1).Value, "#") <> 0 Then Hoja4.Cells(ipuntero + j + 1, 6).Value = CurrentCell.Offset(0, 2).Value Else Hoja4.Cells(ipuntero + j + 1, 6).Value = CurrentCell.Offset(0, 2).Value End If End If Set CurrentCell = NextCell Wend

Mdulo11 - 10 '**************************************************************************** ' BORRAR LAS "~T" ' '**************************************************************************** Windows(Sheetworkb1).Activate Worksheets(1).Activate j = 1 While (Not IsEmpty(Worksheets(1).Cells(j, 1).Value)) Worksheets(1).Cells(j, 1).Select If Worksheets(1).Cells(j, 1).Value = "~T" Then Selection.EntireRow.Select Selection.Delete Shift:=xlUp Else j = j + 1 End If Wend '**************************************************************************** ' PONER LOS DESCOMPUESTOS EN CADA CONCEPTO CONCEPTOS "~D" ' ' NO SE TRATA LA ESTRUCTURA JERARQUICA SINO LOS DESCOMPUESTOS DE PARTIDAS ' '**************************************************************************** Traduce.Estado.Caption = "Tramitando la descomposicin de los conceptos" Set CurrentCell = Range("A1") Windows(Sheetworkb2).Activate '"prexcel_44.xls" Hoja4.Activate If B_import_precdesc = False Then GoTo no_prec_desc While (Not IsEmpty(CurrentCell))

Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "~D" Then If InStr(1, CurrentCell.Offset(0, 1).Value, "##") <> 0 Then ElseIf InStr(1, CurrentCell.Offset(0, 1).Value, "#") <> 0 Then Else

CurrentCell.Value = "D" For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(CurrentCell.Of fset(0, 1).Value) Then Exit For ElseIf Hoja4.Cells(j + ipuntero + 1, 1).Value = CurrentCell.Offset(0, 1).Value Then Exit For End If Next j i = 0 vuelta(1) = 1 a$ = CurrentCell.Offset(0, 2).Value b$ = "" For i = 1 To 99 c(i) = "" d(i) = "" e(i) = "" Next i centinela = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1

Mdulo11 - 11 Else Select Case centinela Case 0 c(vuelta(1)) = c(vuelta(1)) + b$ 'codigo Case 1 d(vuelta(1)) = d(vuelta(1)) + b$ 'factor Case 2 If b$ = "." Then b$ = "," e(vuelta(1)) = e(vuelta(1)) + b$ 'rendimiento Case 3 centinela = 0 vuelta(1) = vuelta(1) + 1 n = n - 1 End Select End If Next n k = 0 Hoja4.Cells(ipuntero + j + 1, 10).Value = "d" Hoja4.Cells(ipuntero + j + 1, 4).Value = "P" For i = 1 To vuelta(1) Hoja4.Cells(ipuntero + j + 1, 100 + k).Value = c(i) If e(i) <> "" Then Hoja4.Cells(ipuntero + j + 1, 100 + k + 1).Value = CDbl(e(i)) 'rendimiento End If Hoja4.Cells(ipuntero + j + 1, 100 + k + 2).Value = d(i) 'factor k = 4 * i Next i End If End If Set CurrentCell = NextCell 'i = i + 1

Wend

'GoTo bye '**************************************************************************** ' BORRAR LAS "D" PERTENECIENTE A LOS DESCOMPUESTOS DE LAS PARTIDAS ' '**************************************************************************** j = 1 Windows(Sheetworkb1).Activate Worksheets(1).Activate While (Not IsEmpty(Worksheets(1).Cells(j, 1).Value)) Worksheets(1).Cells(j, 1).Select If Worksheets(1).Cells(j, 1).Value = "D" Then ipuntero = ipuntero - 1 Selection.EntireRow.Select Else Selection.Delete Shift:=xlUp

j = j + 1 End If Wend no_prec_desc: 'punto de salto en el caso de que no se quieran dscompuestos Windows(Sheetworkb1).Activate Worksheets(1).Activate Traduce.Estado.Caption = "Tramitando el presupuesto del Proyecto" Iestructura = IConceptos + j + 3

Mdulo11 - 12 I_puntero = Iestructura Base(1) = 0 ipoint(1) = 0 B_flag = False While (Worksheets(1).Cells(ipoint(1) + 1, 1).Value <> "" And B_flag = False)

If (Worksheets(1).Cells(ipoint(1) + 1, 1).Value = "~D") And (InStr(1, Worksheets(1).Cells(i point(1) + 1, 2).Value, "##")) <> 0 Then Worksheets(1).Cells(ipoint(1) + 1, 1).Value = "D" i = 0 vuelta(1) = 1 a$ = Worksheets(1).Cells(ipoint(1) + 1, 3).Value b$ = "" For i = 1 To 99 c(i) = "" d(i) = "" e(i) = "" Next i centinela = 0 quedan(1) = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c(vuelta(1)) = c(vuelta(1)) + b$ 'codigo Case 1 d(vuelta(1)) = d(vuelta(1)) + b$ 'factor Case 2 If b$ = "." Then b$ = "," e(vuelta(1)) = e(vuelta(1)) + b$ 'rendimiento Case 3 centinela = 0 vuelta(1) = vuelta(1) + 1 n = n - 1 End Select End If Next n quedan(1) = vuelta(1)

n o sin #

For i = 1 To vuelta(1) Worksheets(1).Cells(I_puntero, 1).Value = Base(1) + i c(i) = Buscar_codigo_presto(c(i), I_numero) Worksheets(1).Cells(I_puntero, 2).Value = c(i) 'aqui esta el tema de trabajo co If e(i) <> "" Then Worksheets(1).Cells(I_puntero, 8).Value = CDbl(e(i)) Else End If I_puntero = I_puntero + 1 Next i '******************************************************************* ' comienzo anidamiento nivel subcapitulo 2

ambia "#") <> 0) Then

For m(2) = 1 To vuelta(1) 'cambia Base(2) = (Base(1) + m(2)) * 100 'cambia ipoint(2) = 0 'cambia While (Worksheets(1).Cells(ipoint(2) + 1, 1).Value <> "" And quedan(1) <> 0) 'c

If Worksheets(1).Cells(ipoint(2) + 1, 1).Value = "~D" Then 'cambia If Worksheets(1).Cells(ipoint(2) + 1, 2).Value = c(m(2)) And (InStr(1, c(m(2)), 'cambia Worksheets(1).Cells(ipoint(2) + 1, 1).Value = "D2" 'cambia quedan(1) = quedan(1) - 1 'cambia vuelta(2) = 1 'cambia

Mdulo11 - 13 a$ = Worksheets(1).Cells(ipoint(2) + 1, 3).Value 'cambia b$ = "" For i = 1 To 99 'esto tiene que ser 99 c2(i) = "" D2(i) = "" e2(i) = "" Next i centinela = 0 quedan(2) = 0 ' 'ferrrr For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c2(vuelta(2)) = c2(vuelta(2)) + b$ 'codigo Case 1 D2(vuelta(2)) = D2(vuelta(2)) + b$ 'factor Case 2 If b$ = "." Then b$ = "," e2(vuelta(2)) = e2(vuelta(2)) + b$ 'rendimiento Case 3 centinela = 0 vuelta(2) = vuelta(2) + 1 'cambia n = n - 1 End Select

End If

Next n If Len(a$) = 0 Then vuelta(2) = 0 quedan(2) = vuelta(2) 'cambia For i = 1 To vuelta(2) Worksheets(1).Cells(I_puntero, 1).Value = Base(2) + i 'cambia c2(i) = Buscar_codigo_presto(c2(i), I_numero) Worksheets(1).Cells(I_puntero, 2).Value = c2(i) 'cambia If e2(i) <> "" Then Worksheets(1).Cells(I_puntero, 8).Value = CDbl(e2(i)) 'cambia Else End If

) 'cambia

I_puntero = I_puntero + 1 Next i '*********************************************************************** '******************************************************************* ' comienzo anidamiento nivel subcapitulo 3 For m3 = 1 To vuelta(2) 'cambia Base(3) = (Base(2) + m3) * 100 'cambia ipoint(3) = 0 'cambia While (Worksheets(1).Cells(ipoint(3) + 1, 1).Value <> "" And quedan(2) <> 0

If Worksheets(1).Cells(ipoint(3) + 1, 1).Value = "~D" Then 'cambia If Worksheets(1).Cells(ipoint(3) + 1, 2).Value = c2(m3) And (InStr( 1, c2(m3), "#") <> 0) Then 'cambia ' CUIDADO AQUI NO TIENE BUENA PINTA Worksheets(1).Cells(ipoint(3) + 1, 1).Value = "D3" 'cambia quedan(2) = quedan(2) - 1 'cambia vuelta(3) = 1 'cambia a$ = Worksheets(1).Cells(ipoint(3) + 1, 3).Value 'cambia b$ = "" For i = 1 To 99 'esto tiene que ser 99 c3(i) = "" D3(i) = "" e3(i) = "" Next i centinela = 0 quedan(3) = 0 'cambia For n = 1 To Len(a$) b$ = Mid(a$, n, 1)

Mdulo11 - 14 If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c3(vuelta(3)) = c3(vuelta(3)) + b$ 'codigo 'c(vuelta(1)) = c(vuelta(1)) + b$ 'codigo Case 1 D3(vuelta(3)) = D3(vuelta(3)) + b$ 'factor Case 2 If b$ = "." Then b$ = "," e3(vuelta(3)) = e3(vuelta(3)) + b$ 'rendimiento Case 3 centinela = 0 vuelta(3) = vuelta(3) + 1 'cambia n = n - 1 End Select End If Next n quedan(3) = vuelta(3) 'cambia

ia

For i = 1 To vuelta(3) 'cambia Worksheets(1).Cells(I_puntero, 1).Value = Base(3) + i 'cambia c3(i) = Buscar_codigo_presto(c3(i), I_numero) Worksheets(1).Cells(I_puntero, 2).Value = c3(i) 'cambia If e3(i) <> "" Then Worksheets(1).Cells(I_puntero, 8).Value = CDbl(e3(i)) 'camb Else

***** *

End If I_puntero = I_puntero + 1 Next i '******************************************************************

'****************************************************************** ' comienzo anidamiento nivel subcapitulo 4

(3) <> 0) 'cambia bia

For m4 = 1 To vuelta(3) 'cambia Base(4) = (Base(3) + m4) * 100 'cambia ipoint(4) = 0 'cambia While (Worksheets(1).Cells(ipoint(4) + 1, 1).Value <> "" And quedan

If Worksheets(1).Cells(ipoint(4) + 1, 1).Value = "~D" Then 'cam

If Worksheets(1).Cells(ipoint(4) + 1, 2).Value = c3(m4) And (InStr(1, c3(m4), "#") <> 0) Then 'cambia ' CUIDADO AQUI NO TIENE BUENA PINTA Worksheets(1).Cells(ipoint(4) + 1, 1).Value = "D4" 'cambia quedan(3) = quedan(3) - 1 'cambia vuelta(4) = 1 'cambia a$ = Worksheets(1).Cells(ipoint(4) + 1, 3).Value 'cambia b$ = "" For i = 1 To 99 'esto tiene que ser 99 c4(i) = "" D4(i) = "" e4(i) = "" Next i centinela = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c4(vuelta(4)) = c4(vuelta(4)) + b$ 'codigo Case 1

Mdulo11 - 15

D4(vuelta(4)) = D4(vuelta(4)) + b$ 'factor Case 2 If b$ = "." Then b$ = "," e4(vuelta(4)) = e4(vuelta(4)) + b$ 'rendimiento Case 3 centinela = 0 vuelta(4) = vuelta(4) + 1 'cambia n = n - 1 End Select End If Next n quedan(4) = vuelta(4) 'cambia

cambia

For i = 1 To vuelta(4) 'cambia Worksheets(1).Cells(I_puntero, 1).Value = Base(4) + i '

)) 'cambia

c4(i) = Buscar_codigo_presto(c4(i), I_numero) Worksheets(1).Cells(I_puntero, 2).Value = c4(i) 'cambia If e4(i) <> "" Then Worksheets(1).Cells(I_puntero, 8).Value = CDbl(e4(i Else

*********

End If I_puntero = I_puntero + 1 Next i '********************************* '********************************************************** ' comienzo anidamiento nivel subcapitulo 5

" And quedan(4) <> 0) 'cambia D" Then 'cambia

For m5 = 1 To vuelta(4) 'cambia Base(5) = (Base(4) + m5) * 100 'cambia ipoint(5) = 0 'cambia While (Worksheets(1).Cells(ipoint(5) + 1, 1).Value <> "

If Worksheets(1).Cells(ipoint(5) + 1, 1).Value = "~

If Worksheets(1).Cells(ipoint(5) + 1, 2).Value = c4(m5) And (InStr(1, c4(m5), "#") <> 0) Then 'cambia ' CUIDADO AQUI NO TIENE BUENA PINTA D5" 'cambia

Worksheets(1).Cells(ipoint(5) + 1, 1).Value = "

e 'cambia

quedan(4) = quedan(4) - 1 'cambia vuelta(5) = 1 'cambia a$ = Worksheets(1).Cells(ipoint(5) + 1, 3).Valu b$ = "" For i = 1 c5(i) D5(i) e5(i) Next i To 99 'esto tiene que ser 99 = "" = "" = ""

centinela = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c5(vuelta(5)) = c5(vuelta(5)) + b$ Case 1 D5(vuelta(5)) = D5(vuelta(5)) + b$ Case 2 If b$ = "." Then b$ = "," e5(vuelta(5)) = e5(vuelta(5)) + b$

'codigo

'factor

Mdulo11 - 16 'rendimiento Case 3 centinela = 0 vuelta(5) = vuelta(5) + 1 'cambia n = n - 1 End Select End If Next n quedan(5) = vuelta(5) 'cambia

ase(5) + i 'cambia o) 5(i) 'cambia d3(i) ' FACTOR

For i = 1 To vuelta(5) 'cambia Worksheets(1).Cells(I_puntero, 1).Value = B

c5(i) = Buscar_codigo_presto(c5(i), I_numer

Worksheets(1).Cells(I_puntero, 2).Value = c 'Worksheets(1).Cells(I_puntero, 3).Value =

= CDbl(e5(i)) 'cambia

If e5(i) <> "" Then Worksheets(1).Cells(I_puntero, 8).Value Else

*********************

End If I_puntero = I_puntero + 1 Next i '********************************* '**********************************************

).Value <> "" And quedan(5) <> 0) 'cambia ).Value = "~D" Then 'cambia

' comienzo anidamiento nivel subcapitulo 6 For m6 = 1 To vuelta(5) 'cambia Base(6) = (Base(5) + m6) * 100 'cambia ipoint(6) = 0 'cambia While (Worksheets(1).Cells(ipoint(6) + 1, 1

If Worksheets(1).Cells(ipoint(6) + 1, 1

If Worksheets(1).Cells(ipoint(6) + 1, 2).Value = c5(m6) And (InStr(1, c5(m6), "#") <> 0) Then 'cambia ' CUIDADO AQUI NO TIENE BUENA PI NTA 1).Value = "D5" 'cambia Worksheets(1).Cells(ipoint(6) + 1, quedan(5) = quedan(5) - 1 'cambia vuelta(6) = 1 'cambia a$ = Worksheets(1).Cells(ipoint(6)

+ 1, 3).Value 'cambia 99

b$ = "" For i = 1 To 99 'esto tiene que ser c6(i) = "" D6(i) = "" e6(i) = "" Next i centinela = 0 'quedan(4) = 0 'cambia

ta(6)) + b$ 'codigo

For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c6(vuelta(6)) = c6(vuel

ta(6)) + b$ 'factor

Case 1 D6(vuelta(6)) = D6(vuel

Mdulo11 - 17

," ta(6)) + b$ 'rendimiento

Case 2 If b$ = "." Then b$ = "

e6(vuelta(6)) = e6(vuel Case 3 centinela = 0

1 'cambia

vuelta(6) = vuelta(6) + n = n - 1 End Select End If Next n quedan(6) = vuelta(6) 'cambia

1).Value = Base(6) + i 'cambia (i), I_numero) 2).Value = c6(i) 'cambia 3).Value = d3(i) ' FACTOR

For i = 1 To vuelta(6) 'cambia Worksheets(1).Cells(I_puntero,

c6(i) = Buscar_codigo_presto(c6 Worksheets(1).Cells(I_puntero,

'Worksheets(1).Cells(I_puntero,

ro, 8).Value = CDbl(e6(i)) 'cambia

If e6(i) <> "" Then Worksheets(1).Cells(I_punte Else End If I_puntero = I_puntero + 1 Next i '*********************************

'************************* End If 'nivel 6 End If 'nivel 6 ipoint(6) = ipoint(6) + 1 'nivel 6 Wend Next m6 '************************* End If 'nivel 5 End If 'nivel 5 ipoint(5) = ipoint(5) + 1 'nivel 5 Wend 'nivel 5 Next m5 'nivel 5 '************************* End If 'nivel 4 End If 'nivel 4 ipoint(4) = ipoint(4) + 1 'nivel 4 Wend 'nivel 4 Next m4 'nivel 4

'************************************************************************** End If 'nivel 3 End If 'nivel 3 ipoint(3) = ipoint(3) + 1 'nivel 3 'ipoint(3) = 0 Wend 'nivel 3 Next m3 'nivel 3 '************************************************************************** End If 'nivel 2 End If 'nivel 2 ipoint(2) = ipoint(2) + 1 'nivel 2

Mdulo11 - 18 Wend 'nivel 2 Next m(2) 'nivel 2 B_flag = True ' ha localizado "##" End If 'nivel 1 ipoint(1) = ipoint(1) + 1 'esto puede que este mal

Wend

'**************************************************************************** ' TRASLADAR LOS DATOS DEL PROYECTO (JERARQUIA) ' '**************************************************************************** 'RemoverPasswordEnHoja 'quitar portecciones hoja4 Set Rkey = Worksheets(1).Cells(Iestructura, 1) Rkey.Select DDCOnceptos = ActiveCell.CurrentRegion.Rows.Count Set Rdestino = Hoja4.Cells(1, 1) Range(ActiveCell, ActiveCell.Offset(DDCOnceptos, 255)).Cut Workbooks(Sheetworkb2).Sheets("Hoja4 ").Range(Rdestino, Rdestino) 'bye: If B_import_med = False Then Exit Sub Traduce.Estado.Caption = "En principio la importacin se ha efectuado." '**************************************************************************** ' PONER LOS DESCOMPUESTOS DE MEDICION EN CADA CONCEPTO CONCEPTOS "~M" ' ' NO SE TRATA LA ESTRUCTURA JERARQUICA SINO LOS DESCOMPUESTOS DE PARTIDAS ' '**************************************************************************** Traduce.Estado.Caption = "Tramitando las mediciones descompuestas del Proyecto" Set CurrentCell = Range("A1") While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "~M" Then

Else

CurrentCell.Value = "M" i = 0 c(1) = "" d(1) = "" 'vuelta(1) = 1 a$ = CurrentCell.Offset(0, 1).Value b$ = "" centinela = 0 For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 Else Select Case centinela Case 0 c(1) = c(1) + b$ 'padre Case 1 d(1) = d(1) + b$ 'hijo End Select End If Next n k = 0 CurrentCell.Offset(0, 1).Value = c(1) CurrentCell.Offset(0, 2).Value = d(1) vuelta(1) = 1

Mdulo11 - 19 a$ = CurrentCell.Offset(0, 4).Value b$ = "" 'D_med_res = CurrentCell.Offset(0, 3).Value 'aqui la medicin parcial For i = 1 To 500 '500 lineas de medicion descompuesta cm(i) = "" 'texto dm(i) = "" 'unidades em(i) = "" 'longitud fm(i) = "" 'ancho gm(i) = "" 'alto Next i 'f$(vuelta) = "" centinela = 0

For n = 1 To Len(a$) b$ = Mid(a$, n, 1) If b$ = "\" Then centinela = centinela + 1 If centinela = 6 Then centinela = 0 If cm(vuelta(1)) = "" And dm(vuelta(1)) = "" And em(vuelta(1)) = "" And fm(vuelta(1)) = "" And gm(vuelta(1)) = "" Then 'esto es porque el sispre parece que pone lineas vacias 'las lineas vacias se pisan Else vuelta(1) = vuelta(1) + 1 End If End If Else Select Case centinela Case 0

Case 1 cm(vuelta(1)) = cm(vuelta(1)) + b$ 'texto med descompues Case 2 If b$ = "." Then b$ = "," dm(vuelta(1)) = dm(vuelta(1)) + b$ 'unidad Case 3 If b$ = "." Then b$ = "," em(vuelta(1)) = em(vuelta(1)) + b$ 'long Case 4 If b$ = "." Then b$ = "," fm(vuelta(1)) = fm(vuelta(1)) + b$ 'ancho Case 5 If b$ = "." Then b$ = "," gm(vuelta(1)) = gm(vuelta(1)) + b$ 'alto Case 6 'centinela = 1 If cm(vuelta(1)) = "" And dm(vuelta(1)) = "" And em(vuelta(1)) = "" And fm(vuelta(1)) = "" And gm(vuelta(1)) = "" Then 'esto es porque el sispre parece que pone lineas vacias 'las lineas vacias se pisan Else vuelta(1) = vuelta(1) + 1 n = n - 1 End If End Select End If

Next n If cm(vuelta(1)) = "" And dm(vuelta(1)) = "" And em(vuelta(1)) = "" And fm(vuelta(1 )) = "" And gm(vuelta(1)) = "" Then vuelta(1) = vuelta(1) - 1 End If CurrentCell.Offset(0, 10).Value = vuelta(1) For i = 1 To vuelta(1) CurrentCell.Offset(0, 4).Value = cm(i) If dm(i) <> "" Then CurrentCell.Offset(0, 5).Value = CDbl(dm(i)) If em(i) <> "" Then CurrentCell.Offset(0, 6).Value = CDbl(em(i)) If fm(i) <> "" Then CurrentCell.Offset(0, 7).Value = CDbl(fm(i)) If gm(i) <> "" Then CurrentCell.Offset(0, 8).Value = CDbl(gm(i))

Mdulo11 - 20 If vuelta(1) <> i Then Set CurrentCell = NextCell Rows(CurrentCell.Row).Insert Shift:=xlDown Set CurrentCell = CurrentCell.Offset(-1, 0) CurrentCell.Value = "MD" 'MEDICION DESCOMPUESTA Set NextCell = CurrentCell.Offset(1, 0) End If Next i

End If Set CurrentCell = NextCell

Wend '**************************************************************************** ' COLOCAR LA MEDICION DESCOMPUESTA "M" ' '**************************************************************************** Windows(Sheetworkb1).Activate Worksheets(1).Activate Set CurrentCell = Range("A1") DDDpunt = 1

While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = "M" Then CurrentCell.Value = "MT" If CurrentCell.Offset(0, 1).Value = "R_A_I_Z##" Or InStr(1, CurrentCell.Offset(0, 1).Va lue, "##") <> 0 Then For j = 1 To DDCOnceptos If Hoja4.Cells(j, 2) = CurrentCell.Offset(0, 2).Value Then i = CurrentCell.Offset(0, 10).Value 'n de lineas de medicion If CurrentCell.Offset(0, 3).Value = "" Then Dtemp4 = 0 Else 'If InStr(1, CurrentCell.Offset(0, 3), ".") <> 0 Then

Dtemp4 = CDbl(CurrentCell.Offset(0, 3).Value) End If Set Celda1 = Workbooks(Sheetworkb1).Worksheets(1).Cells(DDDpunt, 5) Set Celda4 = Workbooks(Sheetworkb1).Worksheets(1).Cells(DDDpunt + i, 10

iones actual (en vigor)

If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de medic End If Dtemp2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row If Dtemp2 > 60000 Then pos_med_col = pos_med_col + 12 Dtemp2 = 8 End If

Set Celda3 = Hoja1.Cells(Dtemp2 + 2, 4 + pos_med_col) Celda1.Select Range(ActiveCell, ActiveCell.Offset(i - 1, 5)).Copy Workbooks(Sheetwork b2).Sheets("Mediciones").Range(Celda3, Celda3) Windows(Sheetworkb2).Activate '"prexcel_44.xls" Hoja1.Activate Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(4, 12) 'solo dos lineas Set Celda3 = Hoja1.Cells(Dtemp2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda3, Celda3) Set Celda3 = Hoja1.Cells(5, 3) Set Celda1 = Hoja1.Cells(Dtemp2 + 2, 3 + pos_med_col) Set Celda4 = Hoja1.Cells(Dtemp2 + 2 + (i - 1), 3 + pos_med_col) Hoja1.Range(Celda3, Celda3).Copy Range(Celda1, Celda4) ion

Hoja1.Cells(Dtemp2, 1 + pos_med_col) = Dtemp4 'el resultado de la medic Hoja4.Activate Set Celda3 = Hoja1.Cells(Dtemp2, 1 + pos_med_col) stemp1 = Range(Celda3, Celda3).Address

Mdulo11 - 21 stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Cells(j, 9) = stemp1 Stemp = "find_DD" Windows(Sheetworkb1).Activate Worksheets(1).Activate End If If Stemp = "find_DD" Then Stemp = "" Exit For End If Next j '****fin****

'es una partida dentro de un capitulo que no es raiz For j = 1 To DDCOnceptos 'Stemp = CurrentCell.Offset(0, 2).Value If Hoja4.Cells(j, 2) = CurrentCell.Offset(0, 2).Value Then Stemp = Strings.Trim(Hoja4.Cells(j, 1)) Stemp = Strings.Left(Stemp, Len(Stemp) - 2) For k = 1 To DDCOnceptos If Strings.Trim(Hoja4.Cells(k, 1)) = Stemp And Hoja4.Cells(k, 2) = CurrentCell.Offset(0, 1).Value Then i = CurrentCell.Offset(0, 10).Value 'n de lineas de medicion If CurrentCell.Offset(0, 3).Value = "" Then Dtemp4 = 0 Else

Else

, 5) + i, 10)

Dtemp4 = CDbl(CurrentCell.Offset(0, 3).Value) End If Set Celda1 = Workbooks(Sheetworkb1).Worksheets(1).Cells(DDDpunt

Set Celda4 = Workbooks(Sheetworkb1).Worksheets(1).Cells(DDDpunt If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna

de mediciones actual (en vigor) .Row

End If Dtemp2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp) If Dtemp2 > 60000 Then pos_med_col = pos_med_col + 12 Dtemp2 = 8 End If

Set Celda3 = Hoja1.Cells(Dtemp2 + 2, 4 + pos_med_col) Celda1.Select Range(ActiveCell, ActiveCell.Offset(i - 1, 5)).Copy Workbooks(S heetworkb2).Sheets("Mediciones").Range(Celda3, Celda3) Windows(Sheetworkb2).Activate '"prexcel_44.xls" Hoja1.Activate Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(4, 12) 'solo dos lineas Set Celda3 = Hoja1.Cells(Dtemp2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda3, Celda3)

col)

Set Celda3 = Hoja1.Cells(5, 3) Set Celda1 = Hoja1.Cells(Dtemp2 + 2, 3 + pos_med_col) Set Celda4 = Hoja1.Cells(Dtemp2 + 2 + (i - 1), 3 + pos_med_ Hoja1.Range(Celda3, Celda3).Copy Range(Celda1, Celda4) Hoja1.Cells(Dtemp2, 1 + pos_med_col) = Dtemp4 'el resultado de Hoja4.Activate Set Celda3 = Hoja1.Cells(Dtemp2, 1 + pos_med_col) stemp1 = Range(Celda3, Celda3).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1)

la medicion

Mdulo11 - 22 Hoja4.Cells(j, 9) = stemp1 Stemp = "find_DD" Windows(Sheetworkb1).Activate Worksheets(1).Activate Exit For End If Next k End If If Stemp = "find_DD" Then Stemp = "" Exit For End If Next j End If End If Set CurrentCell = NextCell DDDpunt = DDDpunt + 1

Wend SuprimirFilasVacias Traduce.Estado.Caption = "En principio la importacin se ha efectuado." End If End Sub

Public Function capituloopartida(ByVal Texto As String) As Integer 'Dim vuelta As Integer Dim a As String Dim c As String Dim b As String Dim d As String 'el nuemero Dim e As String Dim n As Integer Dim centinela As Integer 'PARA QUE SEA PARTIDA TIENE QUE TENER UNIDAD (MENOR DE TRES CARACTERES) Y LA SIGUIENTE CELDA DERECH A MAS DE TRES CARACTERES capituloopartida = 0 If Len(Trim(Texto)) > 3 Then capituloopartida = 1 Else End If End Function Public Function Aparece_totales(ByVal Texto As String) As Integer Aparece_totales = 0 'no aparece If InStr(1, "TOTAL", Texto) <> 0 Then Aparece_totales = 1 ElseIf InStr(1, "total", Texto) <> 0 Then Aparece_totales = 1 End If

End Function Public Function Buscar_codigo_presto(ByVal Texto As String, ByVal Ij As Integer) As String Dim j As Integer Buscar_codigo_presto = Texto If (InStr(1, Texto, "#")) = 0 Then For j = 1 To Ij If Almacen_codigo(j) = Texto + "#" Then

Mdulo11 - 23 Buscar_codigo_presto = Texto + "#" Exit For End If Next j End If End Function Public Sub SuprimirFilasVacias() Dim intUltimaFila As Long Hoja4.Activate intUltimaFila = Columns("A:A").Range("A65536").End(xlUp).Row For R = intUltimaFila To 60002 Step -1 If Application.CountA(Rows(R)) = 0 Then Rows(R).Delete Next R End Sub Dim Dim Dim Dim Sub limpiahojaimportada() Sheetworkb1 As String j As Double i As Integer Ifili_max As Integer Sheetworkb1 = ActiveWorkbook.Name ThisWorkbook.Activate Worksheets(1).Activate

' ACTIVAR LA HOJA

'Set Celda1 = Range("A1") 'Set Celda4 = Range("A1") 'CurrentCell.Select 'Hoja1.Range(Celda1, Celda4).Select Worksheets(1).Cells(1, 1).Select 'Set TopCell = Worksheets(1).Cells(1, ActiveCell.Column) Windows(Sheetworkb1).Activate Worksheets(1).Activate Windows(Sheetworkb1).Activate Worksheets(1).Activate j = 65000 While (IsEmpty(Worksheets(1).Cells(j, 1).Value)) j = j - 1 Wend Ifili_max = j + 1 While (j <> 0) If (IsEmpty(Worksheets(1).Cells(j, 1).Value)) Then Worksheets(1).Cells(j, 1) = "lim" End If j = j - 1 Wend j = Ifili_max While (j <> 0) If Worksheets(1).Cells(j, 1) = "lim" Then Worksheets(1).Rows(j).Delete Shift:=xlUp End If Wend j = j - 1

End Sub

Mdulo2 - 1

Option Explicit '**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** '****************************************************************************************** '* '* ES EL MODULO DE PASO DE INFORMACION ENTRE EXPEDIENTES '* '* '****************************************************************************************** Public Public Public Public Public Public Public D_Proy1 As Double D_Proy2 As Double nprod1 As Double nprod2 As Integer B_cerrado As Boolean E_Itipo_expediente As Integer E_Itipo_expediente_par As Integer

Public Sub E_ordenarconcepto() Dim j As Integer Dim Rinicio, RightCell As Range Dim Rkey As Range Hoja4.Activate j = 0 If IsEmpty(Hoja4.Cells(ipuntero + 1 + j + 1, 1)) Then IConceptos = 0 Else Set Rkey = Hoja4.Cells(ipuntero + 2, 1) Rkey.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set Rinicio = Hoja4.Cells(ipuntero + 2, 1) Range(ActiveCell, ActiveCell.Offset(IConceptos, 255)).Select Selection.Sort Key1:=Rinicio, Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub Public Sub trasladar_prod() Dim i As Double Dim j As Double Dim NextCell As Range Dim Celda1, Celda4, Celda2, Celda3 As Range Dim Dtemp_2 As Double Dim Dtemp_3 As Double Dim stemp1 As String Dim pos_med_col_bis As Double Hoja4.Activate Set NextCell = Hoja4.Cells(D_Proy1 + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count End If For i = (1 + D_Proy1) To (Ipuntos + D_Proy1) j = i + D_Proy2 - D_Proy1 If Hoja4.Cells(j, 2).Value = Hoja4.Cells(i, 2).Value Then Hoja4.Activate Hoja4.Cells(j, 7 + nprod2 * 3) = Hoja4.Cells(i, 7 + nprod1 * 3) Hoja4.Cells(j, 7 + nprod2 * 3 + 1) = Hoja4.Cells(i, 7 + nprod1 * 3 + 1)

Mdulo2 - 2

If Hoja4.Cells(i, 7 + nprod1 * 3 + 2) <> "" Then Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col_bis = 0 Else pos_med_col_bis = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vigor) End If Dtemp_3 = 2 + Hoja1.Cells(Rows.Count, pos_med_col_bis + 3).End(xlUp).Row If Dtemp_3 > 60000 Then pos_med_col_bis = pos_med_col_bis + 12 Hoja1.Cells(1, 3) = pos_med_col_bis Dtemp_3 = 8 End If Set Celda3 = Hoja1.Cells(Dtemp_3, 1 + pos_med_col_bis) stemp1 = Hoja4.Cells(i, 7 + nprod1 * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Dtemp_2 = CDbl(Hoja1.Cells(posicionmedicion, 3 + pos_med_col)) If Dtemp_2 = 0 Then Dtemp_2 = 1 Set Celda1 = Hoja1.Cells(posicionmedicion, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(posicionmedicion + Dtemp_2 + 2, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda3, Celda3) '********************* stemp1 = Range(Celda3, Celda3).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Activate Hoja4.Cells(j, 7 + nprod2 * 3 + 2).FormulaLocal = stemp1 End If

Else "

'error NO EXISTE LA MISMA ESTRUCTURA DE PROYECTO PARA PASAR MsgBox "Los dos espedientes tienen que tener la misma estructura para trasladar mediciones.

Exit Sub End If Next i End Sub

Mdulo3 - 1

'****************************************************************************************** '* '* ES EL MODULO DE AYUDA INSTALACION y PROTECCION HOJAS '* '* '****************************************************************************************** Option Explicit '**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** Public Sub RemoverPasswordEnHoja() 'Hoja2.Activate 'ActiveSheet.Protect "", , , , True 'ActiveSheet.Range("a1").Copy ActiveSheet.Range("a1") End Sub Public Sub ponerPasswordEnHoja() End Sub Public Sub quitaprotec() 'Hoja9.Activate ActiveSheet.Protect "", , , , True ActiveSheet.Range("a1").Copy ActiveSheet.Range("a1") End Sub Public Sub A_limpiar() Dim i As Integer 'rutina de inicializacion para comenzar limpiando todo ipuntero = Hoja7.Range("B23") Hoja4.Activate Cells.Select Selection.ClearContents Hoja1.Activate gor

Hoja1.Cells(1, 3) = "" 'se pone 0 en el rango que indica que columna de medicin esta en vi 'SE BORRA EL BUFFER DE LINEAS DE MEDICION DESCOMPUESTA Hoja1.Range("HU3") = "" 'Hoja1.Range("HU4:IF2000").Select 'Selection.ClearContents Hoja1.Range("HU4:IF2000").ClearContents 'SE BORRA LAS MEDICIONES DESCOMPUESTAS PERTENECIENTES A LAS PARTIDAS 'Range("IG1:IV60000").Select 'Selection.ClearContents Range("IG1:IV60000").ClearContents Cells.Select Selection.ClearContents 'EMPEZAMOS A RELLENAS Hoja1.Cells(2, 4) = "TEXTO" Hoja1.Cells(2, 5) = "UD" Hoja1.Cells(2, 6) = "LONG" Hoja1.Cells(2, 7) = "ANCHO" Hoja1.Cells(2, 8) = "ALTO" Hoja1.Cells(2, 9) = "RESULTADO" Hoja1.Cells(2, 10) = "ENLACE/LINK" Hoja1.Cells(2, 11) = "TIPO FORMULA" Hoja1.Cells(2, 12) = "BUFFER" Hoja1.Cells(2, 12) = "BUFFER" Hoja1.Cells(4, 1) = "ESTA LINEA SIEMPRE VACIA"

Mdulo3 - 2

)"

Hoja1.Cells(6, 1) = "MARCA" Hoja1.Cells(3, 1).FormulaLocal = "0" Hoja1.Cells(3, 2).FormulaLocal = "=FILA(A3)" Hoja1.Cells(3, 3).FormulaLocal = "=SUMA(C4:C6)" 'Hoja1.Cells(5, 3).FormulaLocal = "=SI((SI(ESBLANCO(D5:H5);0;1)+SI(ESBLANCO(J5);0;1))>0;1;0 Hoja1.Cells(5, 3) = "1" '* Hoja8.Activate inicializar_arch_temp

Hoja7.Activate '******************************************************************* 'If Checkrecur.Value = True Then Hoja7.Cells(1, 2) = "" Hoja7.Cells(2, 2) = "" Hoja7.Cells(3, 2) = 0 Hoja7.Cells(4, 2) = "" Hoja7.Cells(5, 2) = 1 Hoja7.Cells(6, 2) = "" Hoja7.Cells(6, 3) = "" 'Hoja7.Cells(6, 4) = "" Hoja7.Cells(7, 2) = "" Hoja7.Cells(8, 2) = "" For i = 9 To 24 Hoja7.Cells(i, 2) = Hoja7.Cells(i, 3) Next i Hoja7.Cells(26, Hoja7.Cells(26, Hoja7.Cells(27, Hoja7.Cells(28, Hoja7.Cells(28, Hoja7.Cells(29, Hoja7.Cells(29, 2) 3) 3) 2) 3) 2) 3) = = = = = = = "" "" "" "true" "true" "true" "true"

Hoja7.Range("B6") = "" Hoja7.Range("B3") = "" Hoja7.Range("B37") = "" 'FECHA PROYECTO Hoja7.Range("B38") = "" Hoja7.Range("B39") = "" Hoja7.Range("B40") = "" 'ASUNTO COPIA DE SEGURIDAD i = 0 Do While IsEmpty(Hoja7.Cells(88, 2 + i)) = False Hoja7.Cells(88, 2 + i) = "" Hoja7.Cells(89, 2 + i) = "" Hoja7.Cells(90, 2 + i) = "" i = i + 1 Loop 'ASUNTO TIPO DE DOCUMENTO/EXPEDIENTE/PROYECTO Hoja7.Range("B94").Value = 0 Hoja7.Range("B95").Value = 0 Hoja7.Range("B95").Value = "" 'no visible Hoja7.Cells(97, 2) = 1 Hoja7.Cells(97, 3) = "" 'QUIERE DECIR QUE ES EDITABLE Hoja7.Cells(97, 4) = 0 ' EL PROYECTO SIEMPRE EN EL 0 Hoja7.Cells(97, 5) For i = 98 To 115 Hoja7.Cells(i, Hoja7.Cells(i, Hoja7.Cells(i, Hoja7.Cells(i, Hoja7.Cells(i, DEJANDO ESPACIO Hoja7.Cells(i, Hoja7.Cells(i, = 0 2) 3) 4) 5) 6) = = = = = "" "" "" "" ""

'VACIO QUIERE DECIR QUE NO ESTA CERRADO, QUE ES EDITABLE 'CONTIENE EL PUNTERO DE INICIO ' CONTIENE EL NUMERO DE REGISTROS DEL EDITOR JERARQUICO 'CONTIENE X, EL VALOR QUE SE SUMA A LA DIVISION DE 60000/N+X PARA IR

7) = "" 'es un buffer para operaciones que borramos 8) = "" 'es un buffer2 para operaciones que borramos

Mdulo3 - 3 Hoja7.Cells(i, 9) = "" 'la certificacion o la produccion n Next i Hoja5.Activate End Sub

Mdulo6 - 1 '**************************************************************************************** '* '* '* ESTE EL EL MODULO DE PRESENTACION DE CONCEPTOS '* '*

'**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** Option Explicit Public Regconcepto As Integer Public Tipo_concepto As Integer Public exitleavecellconcepto As Boolean 'Public Lastcolconcepto As Integer, Lastrowconcepto As Integer Public Lastrowconcepto As Integer Public Laststringconcepto As String Public Data(1 To 900, 1 To 4) Public Sub volcarconcepto() Dim i As Double Dim j, k As Integer Dim Deditarcoste, Deditarimporte As Double Dim Sfiltro As String Dim Smascara As String Dim formats(0 To 4) As String formats(0) formats(1) formats(2) formats(3) formats(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate j = 1 i = (ipuntero + 2) Sfiltro = "" If Tipo_concepto = 1 Then Sfiltro = "mo" ElseIf Tipo_concepto = 2 Then Sfiltro = "maq" ElseIf Tipo_concepto = 3 Then Sfiltro = "mat" ElseIf Tipo_concepto = 4 Then Sfiltro = "sub" ElseIf Tipo_concepto = 5 Then Sfiltro = "P" ElseIf Tipo_concepto = 6 Then Sfiltro = "C" ElseIf Tipo_concepto = 7 Then Sfiltro = "%" End If Do While Strings.Trim(Hoja4.Cells(i, 1)) <> "" Smascara = Strings.Trim(Hoja4.Cells(i, 4)) If Smascara = Sfiltro Or (Smascara = "" And Tipo_concepto = 5) Then j = j + 1 Data(j - 1, 1) = Strings.Trim(Hoja4.Cells(i, 1)) Data(j - 1, 2) = Strings.Trim(Hoja4.Cells(i, 2)) Data(j - 1, 3) = Strings.Trim(Hoja4.Cells(i, 3)) Deditarimporte = CDbl(Hoja4.Cells(i, 5)) Deditarimporte = Round(Deditarimporte, format_prec) Data(j - 1, 4) = Strings.format(Deditarimporte, formats(format_prec)) 'precio End If i = i + 1

Loop

Mdulo6 - 2 IConceptos = i - (ipuntero + 2) Regconcepto = j - 1 CConceptos.ListBox1.List = Data End Sub Public Sub salvaultimodatoconcepto() End Sub Public Sub limpiarcodigo() Dim j As Integer Dim i As Integer CConceptos.ListBox1.Clear For i = 1 To 900 For j = 1 To 4 Data(i, j) = "" 'Data(j, 1) Next j Next i End Sub Public Sub ordenarconcepto() Dim j As Double Dim Rinicio, RightCell As Range Dim Rkey As Range Dim Bfound As Boolean Hoja4.Activate 'Application.ScreenUpdating = True j = 0 IConceptos = 0 Bfound = False If IsEmpty(Hoja4.Cells(ipuntero + 1 + j + 1, 1)) Then 'no hay conceptos luego no se ordena y nos vamos Hoja4.Cells(ipuntero + 1 + j + 1, 1) = "0_ERROR" IConceptos = 1 Else Set Rkey = Hoja4.Cells(ipuntero + 2, 1) Rkey.Select Do While Hoja4.Cells(ipuntero + 2 + j, 1) <> "" If Bfound = False Then If Hoja4.Cells(ipuntero + 2 + j, 1) = "0_ERROR" Then Bfound = True End If End If j = j + 1 Loop If Bfound = False Then Hoja4.Cells(ipuntero + 1 + j + 1, 1) = "0_ERROR" j = j + 1 End If IConceptos = j Set Rinicio = Hoja4.Cells(ipuntero + 2, 1) Range(ActiveCell, ActiveCell.Offset(IConceptos, 255)).Select Selection.Sort Key1:=Rinicio, Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub Public Sub ordenarpresupuesto() Dim j As Double Dim Rinicio, RightCell As Range Dim Rkey As Range Dim ipoint As Double Dim i As Double Dim D_Proy_temp As Double

Mdulo6 - 3 Dim Ipuntos_temp As Double Hoja4.Activate 'Application.ScreenUpdating = True IConceptos = 0

For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then D_Proy_temp = Hoja7.Cells(97 + i, 4) 'Ipuntos_temp = Hoja7.Cells(97 + i, 5) Set Rkey = Hoja4.Cells(D_Proy_temp + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos_temp = 0 Else Ipuntos_temp = ActiveCell.CurrentRegion.Rows.Count End If '**** If IsEmpty(Hoja4.Cells(D_Proy_temp + 1, 1)) Then 'no hay conceptos luego no se ordena y nos vamos Else

j = 0 Set Rkey = Hoja4.Cells(D_Proy_temp + 1, 1) Rkey.Select Do While Hoja4.Cells(D_Proy_temp + 1 + j, 1) <> ""

j = j + 1 Loop IConceptos = j Set Rinicio = Hoja4.Cells(D_Proy_temp + 1, 1) Range(ActiveCell, ActiveCell.Offset(IConceptos, 255)).Select Selection.Sort Key1:=Rinicio, Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End If Next i

End Sub

Public Sub entradacodigoconcepto(ByVal Lii As Integer, ByVal Scelda As String, ByVal STempcodigo As String) Dim i, j As Double Dim Respuesta As Integer Dim Celda1, Celda4 As Range Dim ipoint As Integer Dim Laststringconcepto_temp As String Hoja4.Activate If (Lii - 1) > Regconcepto Then Exit Sub i = 1 If car_raros(Scelda) Then limpiarcodigo volcarconcepto Exit Sub End If

Mdulo6 - 4 ipoint = 0 If Strings.Trim(Scelda) = "" Then If (Lii - 1) < Regconcepto Then For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then

D_Proy = Hoja7.Cells(97 + i, 4) Ipuntos = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos If Strings.Trim(Hoja4.Cells(j + D_Proy, 2)) = Strings.Trim(STempcodigo) The MsgBox "No se puede borrar un concepto que esta en el presupuesto!!!" Exit Sub End If Next j End If Next i 'SEGUNDO EN LA DESCOMPOSICION DE PARTIDAS For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(STempcodigo) Then MsgBox "No se puede borrar un concepto que esta de auxiliar de partida!!!" Exit Sub End If j = j + 1 Loop Next

Respuesta = MsgBox("Est seguro de borrarlo?", vbYesNo, "ATENCIN") If Respuesta = 6 Then Hoja4.Activate For i = (ipuntero + 2) To (IConceptos + ipuntero + 2) If Strings.Trim(Hoja4.Cells(i, 1)) = Strings.Trim(STempcodigo) Then Exit For End If Next i Set Celda1 = Hoja4.Cells(i, 1) Set Celda4 = Hoja4.Cells(i, 250) Hoja4.Range(Celda1, Celda4).Select Selection.Delete Shift:=xlUp ordenarconcepto limpiarcodigo volcarconcepto End If End If If (Lii - 1) < Regconcepto Then Hoja4.Activate ' AQUI SE CAMBIA UN CODIGO POR OTRO If Strings.Trim(Scelda) = "Redondeo" Then Exit Sub If Strings.Trim(Scelda) = "&&" Then Exit Sub If tipo_de_concepto(Scelda) <> "C" And Tipo_concepto = 6 Then 'Es un codigo a introducir de tipo capitulo y no estamos en capitulos MsgBox "El cdigo nuevo tiene que tener inscrita el filtro de captulos!!!" Exit Sub ElseIf (InStr(1, Scelda, "%") = 0) And Tipo_concepto = 7 Then 'ComboBox1.AddItem "a auxiliar" 'Tipo_concepto = 3 NO SE PUEDE CAMBIAR NADA A AUXILIAR MsgBox "El cdigo nuevo tiene que tener inscrito la letra %!!!" Exit Sub End If

Else

Mdulo6 - 5 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Scelda) Then MsgBox "Este concepto existe en la base de conceptos!!!" Exit Sub 'Esta repetido End If Next j For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then D_Proy = Hoja7.Cells(97 + i, 4) Ipuntos = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos If Strings.Trim(Hoja4.Cells(j + D_Proy, 2)) = Strings.Trim(STempcodigo) Then Hoja4.Cells(j + D_Proy, 2) = Strings.Trim(Scelda) End If Next j End If Next i For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(STempcodigo) Then Hoja4.Cells(j + ipuntero + 1, 1) = Strings.Trim(Scelda) Exit For 'Esta sustituido End If Next j 'CUARTO CAMBIAR EL CODIGO EN LOS DESCOMPUESTOS For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(STempcodigo) Then Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Scelda) End If j = j + 1

Else

Next

Loop

'SE INTRODUCE UN NUEVO CODIGO For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Scelda) Then MsgBox "Este concepto existe en la base de conceptos!!!" CConceptos.Cuadroconcepto.Cells(Lii, 1) = ""

Exit Sub 'Esta repetido End If Next j '***** Hoja4.Cells(ipuntero + 2 + IConceptos, 1) = Strings.Trim(Scelda) 'Scelda es el nuevo cdigo Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "%" Tipo_concepto = 7 CConceptos.Caption = " Editor de Conceptos;" & " Medios Auxiliares" limpiarcodigo volcarconcepto ElseIf (InStr(1, Scelda, Filtromaq) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "maq" Tipo_concepto = 2 CConceptos.Caption = " Editor de Conceptos;" & " Maquinaria" limpiarcodigo volcarconcepto ElseIf (InStr(1, Scelda, Filtroman) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "mo" Tipo_concepto = 1 CConceptos.Caption = " Editor de Conceptos;" & " Mano de Obra" limpiarcodigo volcarconcepto

Mdulo6 - 6 ElseIf (InStr(1, Scelda, Filtromat) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "mat" Tipo_concepto = 3 CConceptos.Caption = " Editor de Conceptos;" & " Materiales" limpiarcodigo volcarconcepto ElseIf (InStr(1, Scelda, Filtrosub) <> 0) Then Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "sub" Tipo_concepto = 4 CConceptos.Caption = " Editor de Conceptos;" & " Subcontratas" limpiarcodigo volcarconcepto Else

tos"

Hoja4.Cells(ipuntero + 2 + IConceptos, 4) = "P" Tipo_concepto = 5 CConceptos.Caption = " Editor de Conceptos;" & " Partidas alzadas, otros concep limpiarcodigo volcarconcepto

End If ordenarconcepto End If End If End Sub Public Sub det_Existvalueconcepto() 'para empezar la edicin y determinar la cadena de texto de la columna 1 fila 2 (o la primera) Dim i As Double Dim j, k As Integer Dim Deditarcoste, Deditarimporte As Double Dim Sfiltro As String Dim Smascara As String Hoja4.Activate j = 1 i = (ipuntero + 2) Sfiltro = "" If Tipo_concepto = 1 Sfiltro = "mo" ElseIf Tipo_concepto Sfiltro = "maq" ElseIf Tipo_concepto Sfiltro = "mat" ElseIf Tipo_concepto Sfiltro = "sub" ElseIf Tipo_concepto Sfiltro = "P" ElseIf Tipo_concepto Sfiltro = "C" ElseIf Tipo_concepto Sfiltro = "%" End If Then = 2 Then = 3 Then = 4 Then = 5 Then = 6 Then = 7 Then

End Sub Public Sub List_Head_concepto() Dim DataHead(1 To 1, 1 To 4) CConceptos.ListBox3.ColumnCount = 4 CConceptos.ListBox3.ColumnWidths = "80;40;300;40" DataHead(1, DataHead(1, DataHead(1, DataHead(1, 1) 2) 3) 4) = = = = "Cdigo" "Ud." "Descripcin" "Precio"

Mdulo6 - 7

CConceptos.ListBox3.List = DataHead End Sub

Mdulo7 - 1

'****************************************************************************************** '* '* ES EL MODULO DE MEDICION '* '* '****************************************************************************************** Option Explicit '**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** Public ipoint_med As Double 'contiene la fila del concepto en la estructura. Public Regdis As Integer Public exitleavecelldis As Boolean Public Lastcoldis As Integer, Lastrowdis As Integer Public Laststringdis As String Public Existvaluedis As String Public posicionmedicion As String Public pos_med_col As String Public filamedicion As Integer Public Binsertarlineamed As Boolean Public Bdescomposicionmed As Boolean 'se encarga de indicar que hay descompuesto medicion Public DataMed(1 To 900, 1 To 7) Public D_linea_insert As Double Public Sub volcardis() Dim j As Integer Dim Dim Dim Dim Dim totalmedlinea As Double totalmedpartida As Double Da, Db, Dc, dd As Double Stemp As String formats(0 To 4) As String = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

formats(0) formats(1) formats(2) formats(3) formats(4)

Hoja1.Activate totalmedlinea = 0 totalmedpartida = 0 j = 1 Bdescomposicionmed = False

Do While Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionme dicion + 1, 5 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) <> "" Bdescomposicionmed = True If Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "nuevalinea" Then Db = 0 Dc = 0 dd = 0 Da = 0 If Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) = "" Then DataMed(j, 1) = Strings.Trim(Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col)) 't exto Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, format_meddes) DataMed(j, 2) = Strings.format(Da, formats(format_meddes)) Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col)) Db = Round(Db, format_meddes)

Mdulo7 - 2 DataMed(j, 3) = Strings.format(Db, formats(format_meddes)) Dc = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col)) Dc = Round(Dc, format_meddes) DataMed(j, 4) = Strings.format(Dc, formats(format_meddes)) dd = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col)) dd = Round(dd, format_meddes) DataMed(j, 5) = Strings.format(dd, formats(format_meddes)) If Da = 0 Then totalmedlinea = 0 DataMed(j, 6) = Strings.format(totalmedlinea, formats(format_med)) Else If Db = 0 Then Db = 1 If Dc = 0 Then Dc = 1 If dd = 0 Then dd = 1 'totalmedlinea = Da * Db * Dc * dd 'totalmedlinea = Round(totalmedlinea, format_med) DataMed(j, 6) = Strings.format(Da * Db * Dc * dd, formats(format_med)) totalmedlinea = DataMed(j, 6) End If Hoja1.Cells(j + posicionmedicion + 1, 9 + pos_med_col) = totalmedlinea

Else

exto

'=============================================================================== '* ESTAMOS EN EL CASO DE QUE TENEMOS UNA REFERENCIA DataMed(j, 1) = Strings.Trim(Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col)) 't

'LA COLUMNA 10 DEBERIA EN ESTE MOMENTO COMPROBAR LA REFERENCIA PARA VER SI SE HA PERDID DataMed(j, 7) = Strings.Trim(Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col)) Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, format_meddes) DataMed(j, 2) = Strings.format(Da, formats(format_meddes))

Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 11 + pos_med_col)) Db = Round(Db, format_meddes) If Db = 0 Then totalmedlinea = 0 Else If Da = 0 Then totalmedlinea = 0 DataMed(j, 6) = Strings.format(totalmedlinea, formats(format_med)) Else 'totalmedlinea = Da * Db 'totalmedlinea = Round(totalmedlinea, format_med) DataMed(j, 6) = Strings.format(Da * Db, formats(format_med)) totalmedlinea = DataMed(j, 6) End If End If DataMed(j, 3) = Strings.format(Db, formats(format_meddes))

Hoja1.Cells(j + posicionmedicion + 1, 9 + pos_med_col) = totalmedlinea End If j = j + 1 totalmedpartida = totalmedpartida + totalmedlinea Else j = j + 1

Mdulo7 - 3 totalmedlinea = 0 End If Loop totalmedpartida = Round(totalmedpartida, format_med) Hoja1.Cells(posicionmedicion, 1 + pos_med_col) = CDbl(totalmedpartida) Medic.ListBox1.List = DataMed Medic.Total.Caption = Strings.format(totalmedpartida, formats(format_med)) If j = 1 Then Regdis = 2 Hoja1.Cells(posicionmedicion, 3 + pos_med_col) = CDbl(0) Else Regdis = j Hoja1.Cells(posicionmedicion, 3 + pos_med_col) = CDbl(j - 1) End If End Sub Public Sub salvaultimodatodis() Dim Lj As Integer End Sub Public Sub limpiardis() Dim j As Integer Dim i As Integer Medic.ListBox1.Clear For i = 1 To 900 For j = 1 To 7 DataMed(i, j) = "" Next j Next i End Sub Public Sub entradaref(ByVal Lii As Integer, ByVal Scelda As String) Dim i, j As Integer Dim Celda1, Celda4 As Range Hoja1.Activate ' LA DE MEDICIONES If (Lii - 1) > Regdis Then Exit Sub If Strings.Trim(Scelda) = "" Then If 2 = Regdis Then

If Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 10 + pos_med_col) <> Strings.Trim("") Then Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 10 + pos_med_col) = "" Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 11 + pos_med_col) = "" limpiardis End If Else

If (Lii - 1) <> Regdis Then Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 10 + pos_med_col) = "" Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 11 + pos_med_col) = "" If Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 4 + pos_med_col) = "" And Hoja1.Cells( (Lii - 1) + posicionmedicion + 1, 5 + pos_med_col) = "" And Hoja1.Cells((Lii - 1) + posicionmedicio n + 1, 6 + pos_med_col) = "" And Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 7 + pos_med_col) = " " And Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 8 + pos_med_col) = "" And Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 10 + pos_med_col) = "" Then Set Celda1 = Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp limpiardis End If

Mdulo7 - 4 End If End If

Else

If (Lii - 1) <> Regdis Hoja1.Cells((Lii Hoja1.Cells((Lii s.Trim(Scelda) Hoja1.Cells((Lii Hoja1.Cells((Lii Hoja1.Cells((Lii Else

Then 1) + posicionmedicion + 1, 10 + pos_med_col) = Strings.Trim(Scelda) 1) + posicionmedicion + 1, 11 + pos_med_col).FormulaLocal = "=" & String 1) + posicionmedicion + 1, 6 + pos_med_col) = "" 1) + posicionmedicion + 1, 7 + pos_med_col) = "" 1) + posicionmedicion + 1, 8 + pos_med_col) = ""

Range("A5:L5").Copy Set Celda1 = Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells((Lii - 1) + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown Hoja1.Cells((Lii Hoja1.Cells((Lii s.Trim(Scelda) Hoja1.Cells((Lii Hoja1.Cells((Lii Hoja1.Cells((Lii End If End If End Sub Public Sub crearenlacemedicion() Dim Celda1, Celda4, Celda2 As Range Dim Dtemp_1 As Double Dim Dtemp_2 As Double Dim Dtemp_3 As Double Dim Dtemp_4 As Double Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Dim Li As Long Dim Dtempposicion As Double Dim Respuesta As Integer Dim tempposicionconcepto As String Dim i As Integer, ipoint As Integer On Error Resume Next '*********************************************************************************** '* '* '* ver si tiene medicin descompuesta o no '* '* If Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then If Err = 0 Then stemp1 = Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 Medic.Show Hoja4.Activate 'Mexcel.UserForm_Activate limpiar volcardatos Mexcel.ListBox1.ListIndex = 0 editarestado

- 1) + posicionmedicion + 1, 10 + pos_med_col) = Strings.Trim(Scelda) - 1) + posicionmedicion + 1, 11 + pos_med_col).FormulaLocal = "=" & String - 1) + posicionmedicion + 1, 6 + pos_med_col) = "" - 1) + posicionmedicion + 1, 7 + pos_med_col) = "" - 1) + posicionmedicion + 1, 8 + pos_med_col) = ""

Else

Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) = "" End If

Mdulo7 - 5 Else Hoja1.Activate If Hoja1.Cells(1, 3) = "" Then pos_med_col = 0 Else pos_med_col = CDbl(Hoja1.Cells(1, 3)) 'contiene la columna de mediciones actual (en vigor) End If Dtemp_2 = 2 + Hoja1.Cells(Rows.Count, pos_med_col + 3).End(xlUp).Row If Dtemp_2 > 60000 Then pos_med_col = pos_med_col + 12 Hoja1.Cells(1, 3) = pos_med_col Dtemp_2 = 8 End If posicionmedicion = Dtemp_2 Set Celda1 = Hoja1.Cells(3, 1) Set Celda4 = Hoja1.Cells(6, 12) Set Celda2 = Hoja1.Cells(Dtemp_2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Copy Range(Celda2, Celda2) stemp1 = Range(Celda2, Celda2).Address stemp1 = "=Mediciones!" & SolamenteRefrelativas(stemp1) Hoja4.Activate Hoja4.Cells(ipoint_med + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal = stemp1 Medic.Show Hoja4.Activate limpiar volcardatos Mexcel.ListBox1.ListIndex = 0 'Mexcel.UserForm_Activate editarestado End If End Sub Public Function SolamenteNumeros(ByVal Texto As String) As String 'Dim vuelta As Integer Dim c As String Dim b As String Dim n As Integer SolamenteNumeros = "" c = "" For n = 1 To Len(Texto) b = Mid(Texto, n, 1) If IsNumeric(b$) Then c = c + b 'codigo End If Next SolamenteNumeros = c End Function Public Function SolamenteRef(ByVal Texto As String) As String Dim c As String Dim b As String Dim n As Integer Dim centinela As Boolean SolamenteRef = "" c = "" centinela = False For n = 1 To Len(Texto) b = Strings.Mid(Texto, n, 1) If centinela Then c = c + b End If If b = "!" Then centinela = True End If Next

Mdulo7 - 6 SolamenteRef = c End Function Public Function SolamenteRefrelativas(ByVal Texto As String) As String Dim c As String Dim b As String Dim n As Integer SolamenteRefrelativas = "" c = "" For n = 1 To Len(Texto) b = Strings.Mid(Texto, n, 1) If b = "$" Then 'NO PASA NADA Else c = c + b End If Next SolamenteRefrelativas = c End Function Public Function Solamenteenlaces(ByVal Texto As String) As Integer 'Dim vuelta As Integer Dim a As String Dim c As String Dim b As String Dim d As String Dim e As String Dim n As Integer Dim centinela As Integer Dim Iencontro As Integer Dim Bletraprimero As Boolean Solamenteenlaces = 0 Bletraprimero = False If "=" = Mid(Texto, 1, 1) Or "#NAME?" = Texto Then Solamenteenlaces = 3 Exit Function End If For n = 1 To Len(Texto) b = Mid(Texto, n, 1) If "]" = b Then Solamenteenlaces = 1 Exit Function ElseIf "[" = b Then Solamenteenlaces = 1 Exit Function End If Next c = "" For n = 1 To Len(Texto) b = Mid(Texto, n, 1) If "!" = b Then c = "find" End If Next If c <> "find" Then Solamenteenlaces = 5 Exit Function End If c = "" a = "" d = "" e = "" centinela = 0 Iencontro = 0 For n = 1 To Len(Texto) b = Mid(Texto, n, 1) If b = "!" Then centinela = centinela + 1 If centinela >= 2 Then

Mdulo7 - 7 Solamenteenlaces = 0 Exit Function End If a = a + b Iencontro = 1 'error

Else

ro

Select Case centinela Case 0 a = a + b ' String con la hoja Case 1 If IsNumeric(b) Then e = e + b If Iencontro = 2 Then Iencontro = 3 'llego tubo libro, letra y nume Else 'AQUI ENTRAN LAS LETRAS If Len(e) = 0 Then Bletraprimero = True Else Bletraprimero = False End If Iencontro = 2 d = d + b End If End Select

End If Next If Len(d) > 2 Then Solamenteenlaces = 4 Exit Function End If

'error

If Iencontro = 3 And Bletraprimero Then Solamenteenlaces = 2 End Function Public Sub crearhueco_med() 'Dim RightCell As Range Dim Celda1, Celda4 As Range Dim Li As Long Dim Stemp As String Li = Lastrowdis + 1 Li = Li - 1 Binsertarlineamed = True D_linea_insert = Li

' parece que todo correcto

Set Celda1 = Hoja1.Cells(5, 1) Set Celda4 = Hoja1.Cells(5, 12) Hoja1.Range(Celda1, Celda4).Copy Set Celda1 = Hoja1.Cells(Li + posicionmedicion + 2, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(Li + posicionmedicion + 2, 1 + pos_med_col) Hoja1.Range(Celda1, Celda4).Insert Shift:=xlDown Hoja1.Cells(Li + posicionmedicion + 2, 4 + pos_med_col) = "nuevalinea"

'exitleavecelldis = False 'Medic.Cuadrodis.Cells.Range("A2:G666").ClearContents 'Lastcoldis = 1 'Lastrowdis = Li + 2 'Set Celda1 = Medic.Cuadrodis.Cells(Lastrowdis, Lastcoldis) 'Medic.Cuadrodis.Cells.Range(Celda1, Celda1).Select limpiardis volcardis 'exitleavecelldis = True

Mdulo7 - 8 End Sub Public Sub actualizar_ref_mediciones() 'Entra dentro de la hoja de mediciones y convierte la formula (que es una referencia) ' en un sprite con la referencia menos "el igual" ' de esta forma se controla que el texto y la referencia esten cuadrados y sealen el mismo punto Dim Dtemp_2 As Double Dim stemp1 As String Dim i As Double Hoja1.Activate Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row i = 8 Do While i <= Dtemp_2 If Hoja1.Cells(i, 10 + pos_med_col) <> "" Then stemp1 = Hoja1.Cells(i, 10 + pos_med_col + 1).FormulaLocal stemp1 = Strings.Right(stemp1, (Len(stemp1) - 1)) Hoja1.Cells(i, 10 + pos_med_col) = stemp1 End If i = i + 1 Loop End Sub Public Sub actualizar_ref_mediciones_alreves(ByVal Lii As Integer) 'Entra dentro de la hoja de mediciones y convierte el sprite en una referencia ' es lo contrario de la funcion anterior ' de esta forma se controla que el texto y la referencia esten cuadrados 'puesto que antes se ha llamado a la funcion anterior 'esta funcion se llama despues de hacer la funcion pegar conceptos Dim Dtemp_2 As Integer Dim stemp1 As String Dim i As Integer Hoja1.Activate Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row Do While Lii <= Dtemp_2 If Hoja1.Cells(Lii, 10 + pos_med_col) <> "" Then stemp1 = Hoja1.Cells(Lii, 10 + pos_med_col) Hoja1.Cells(Lii, 10 + pos_med_col + 1).FormulaLocal = "=" & stemp1 End If Lii = Lii + 1 Loop End Sub Public Sub verificar_med_descompuestas() 'vigila que cuando se empiece el programa las mediciones descompuestas 'no esten colgadas. Si estan colgadas las borran. Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dtemp_1 As Double Dtemp_2 As Double Dtemp_3 As Double Dtemp_4 As Double Dtemp_5 As Double stemp1 As String i, j As Integer Bfind As Boolean Celda1 As Range Celda4 As Range 1).FormulaLocal 2).FormulaLocal 3).FormulaLocal 3).FormulaLocal = = = =

Hoja1.Activate Hoja1.Cells(3, Hoja1.Cells(3, Hoja1.Cells(3, Hoja1.Cells(5, )" Hoja1.Cells(4,

"=SUMA(I4:I6)" "=FILA(A3)" "=SUMA(C4:C6)" "=SI((SI(ESBLANCO(D5);0;1)+SUMA(E5:H5)+SI(ESBLANCO(J5);0;1))>0;1;0

1) = "Esta lnea siempre vacia"

Mdulo7 - 9 pos_med_col = 0 Dtemp_2 = 1 + Hoja1.Cells(Rows.Count, pos_med_col + 1).End(xlUp).Row i = 8 Do While i <= Dtemp_2 If Hoja1.Cells(i, 2 + pos_med_col) <> "" Then Bfind = False For j = 1 To Ipuntos If Hoja4.Cells(j + D_Proy, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(j + D_Proy, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal If SolamenteNumeros(stemp1) = i Then Bfind = True Exit For End If End If Next j If Bfind = False Then 'no se ha encontrado el link luego se borra la medicin descompuesta Hoja1.Cells(i, 2 + pos_med_col) = "marca" End If End If i = i + 1 Loop i = 8 Do While i <= Dtemp_2 If Hoja1.Cells(i, 2 + pos_med_col) = "marca" Then Dtemp_5 = CDbl(Hoja1.Cells(i, 3 + pos_med_col)) If Dtemp_5 = 0 Then j = 4 Else 'solo una linea para copiar j = Dtemp_5 + 3 End If Set Celda1 = Hoja1.Cells(i, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(i + j, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp i = i - 1 End If i = i + 1

Loop

End Sub Public Sub List_Head_medic() Dim DataHead(1 To 1, 1 To 7) Medic.ListBox3.ColumnCount = 7 Medic.ListBox3.ColumnWidths = "220;70;70;70;70;70;100" DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, DataHead(1, 1) 2) 3) 4) 5) 6) 7) = = = = = = = "Texto" "Ud." "Long." "Ancho" "Alto" "Med. Parcial" "Enlace Hoja Med."

Medic.ListBox3.List = DataHead End Sub Public Sub calcularmed()

Mdulo7 - 10 Dim j As Integer Dim Dim Dim Dim totalmedlinea As Double totalmedpartida As Double Da, Db, Dc, dd As Double Stemp As String

Hoja1.Activate totalmedlinea = 0 totalmedpartida = 0 j = 1 Bdescomposicionmed = False

Do While Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionme dicion + 1, 5 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) <> "" 'HAY DESCOMPOSICION Bdescomposicionmed = True If Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "nuevalinea" Then Db Dc dd Da If = 0 = 0 = 0 = 0 Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) = "" Then Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, format_meddes) Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col)) Db = Round(Db, format_meddes) Dc = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col)) Dc = Round(Dc, format_meddes) dd = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col)) dd = Round(dd, format_meddes) If Da = 0 Then totalmedlinea = 0 Else If Db = 0 Then Db = 1 If Dc = 0 Then Dc = 1 If dd = 0 Then dd = 1 totalmedlinea = Da * Db * Dc * dd totalmedlinea = Round(totalmedlinea, format_med) End If Else Hoja1.Cells(j + posicionmedicion + 1, 9 + pos_med_col) = totalmedlinea Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, format_meddes) Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 11 + pos_med_col)) Db = Round(Db, format_meddes) If Db = 0 Then totalmedlinea = 0 Else If Da = 0 Then totalmedlinea = 0 Else

totalmedlinea = Da * Db totalmedlinea = Round(totalmedlinea, format_med) End If End If Hoja1.Cells(j + posicionmedicion + 1, 9 + pos_med_col) = totalmedlinea

Mdulo7 - 11

End If j = j + 1 totalmedpartida = totalmedpartida + totalmedlinea Else j = j + 1 totalmedlinea = 0 End If Loop totalmedpartida = Round(totalmedpartida, format_med) Hoja1.Cells(posicionmedicion, 1 + pos_med_col) = CDbl(totalmedpartida) End Sub Public Sub recal_med() 'recalcula los decimales y las mediciones de todo el proyecto (todos los expedientes) Dim j As Double, ipoint As Double Dim i As Double Dim stemp1 As String Dim Dtemp As Double Dim Itipo_de_proyecto_temp As Double Dim D_Proy_temp As Double Dim Ipuntos_temp As Double Application.Calculation = xlAutomatic format_med = Hoja7.Range("B15") format_prec = Hoja7.Range("B16") format_import = Hoja7.Range("B17") format_renrec = Hoja7.Range("B18") format_precrec = Hoja7.Range("B19") format_imprec = Hoja7.Range("B20") format_meddes = Hoja7.Range("B21") Hoja1.Activate Itipo_de_proyecto_temp = 0 For i = 0 To 18 If Hoja7.Cells(97 + i, 2) <> "" Then

laLocal

D_Proy_temp = Hoja7.Cells(97 + i, 4) Ipuntos_temp = Hoja7.Cells(97 + i, 5) For j = 1 To Ipuntos_temp If Hoja4.Cells(j + D_Proy_temp, 7 + Itipo_de_proyecto_temp * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(j + D_Proy_temp, 7 + Itipo_de_proyecto_temp * 3 + 2).Formu stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column

pos_med_col = pos_med_col - 1 calcularmed Hoja4.Cells(j + D_Proy_temp, 7 + Itipo_de_proyecto_temp * 3 + 1) = Hoja4.Cells( j + D_Proy_temp, 7 + Itipo_de_proyecto_temp * 3 + 2) End If Next j End If Next i End Sub Public Sub eliminarnuevalineamed() Dim Celda1, Celda4 As Range Dim Li As Long Binsertarlineamed = False Li = D_linea_insert + 1

If 2 = Regdis And Li = 1 Then ' solo esta esa linea y por su puesto no se borra pero si su cont enido

Mdulo7 - 12 Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Hoja1.Cells(Li + posicionmedicion Medic.ListBox1.ListIndex = 0 'limpiardis Else + + + + + + + + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 + pos_med_col) = "" 5 + pos_med_col) = "" 6 + pos_med_col) = "" 7 + pos_med_col) = "" 8 + pos_med_col) = "" 9 + pos_med_col) = "" 10 + pos_med_col) = "" 11 + pos_med_col) = "" 12 + pos_med_col) = ""

If Li <> Regdis Then Set Celda1 = Hoja1.Cells(Li + posicionmedicion + 1, 1 + pos_med_col) Set Celda4 = Hoja1.Cells(Li + posicionmedicion + 1, 12 + pos_med_col) Hoja1.Range(Celda1, Celda4).Delete Shift:=xlUp

End If End If Regdis = Regdis - 1

limpiardis volcardis End Sub

Mdulo8 - 1

'************************************************************************************ '* '* HOJA DE IMPORTACIONES / EXPORTACIONES '* EXCEL A MEXCEL y EXPORTACION BC3 '* '************************************************************************************ Option Explicit 'modulo actualizado el 28 de Mayo '**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. Ver fecha de actualizacin en Config '**************************************************************** Public Lii_codigo As Integer Public Lii_partidas As Integer Public Ipunteroestructura As Integer Public Ipunterocodigos As Integer Public I_nivelmax As Integer Public Tituloarchivobc3 As String Public Lii_puntero As Integer Public Lii_puntero_estructura As Integer

Public Function excel_amexcel() As Integer Dim j As Double Dim i As Integer Dim Ifili_max As Integer 'es la maxima fila de la estructura del presupuesto que ha puesto el usuar io Dim I_nivel As Integer Dim TopCell As Range Dim BottomCell As Range Dim Celda1 As Range Dim Celda2 As Range Dim I_hubocapitulo As Integer Dim I_solopartidas As Integer Dim I_tipo As Integer Hoja2.Activate excel_amexcel = 0 Ifili_max = inicializa If Ifili_max = 0 Then excel_amexcel = 1 Exit Function End If Hoja2.Cells(1, 1) = "C" Hoja2.Cells(1, 2) = "0" j = Ifili_max - 2 I_nivel = 0 I_hubocapitulo = 1 I_solopartidas = 0 Do While (I_nivel < I_nivelmax And I_hubocapitulo = 1) I_hubocapitulo = 0 Set Celda1 = Hoja2.Cells(2, 10 + I_nivel) Set Celda4 = Hoja2.Cells(2, 10 + I_nivel) Hoja2.Range(Celda1, Celda4).Select I_tipo = 0 Li = 2 Imarca = 1 ILine = 1 While (j <> 0) If IsEmpty(Hoja2.Cells(Li, 1)) Then 'no Ha sido tramitada

If IsEmpty(Hoja2.Cells(Li, 10 + I_nivel)) Then If I_nivel = 0 And Li = 2 Then excel_amexcel = 1

Mdulo8 - 2 MsgBox "LA PRIMERA FILA Y COLUMNA NO PUEDE ESTAR VACIA" Exit Function ElseIf I_nivel = 0 Then Hoja2.Cells(Li, 3 + I_nivel) = ILine - 1 Else Hoja2.Cells(Li, 3 + I_nivel) = ILine - 1 End If If IsNumeric(Hoja2.Cells(Li, 10 + I_nivel)) Then Hoja2.Cells(Li, 1) = "Error" ElseIf Aparece_totales(Hoja2.Cells(Li, 10 + I_nivel)) = 1 Then Hoja2.Cells(Li, 1) = "LINEA DE TOTALES" 'pone total o subtotal I_tipo = 0 Else If capituloopartida(Hoja2.Cells(Li, 10 + I_nivel)) = 1 Then 'es capitulo

Else

el siguiente

Hoja2.Cells(Li, 1) = "C" I_hubocapitulo = 1 'existe capitulo en este nievel, luego se continuira con '*************************************************** 'ESTA PARTE SIRVE PARA MARCAR EL NUMERO DENTRO DE LOS CAPITULOS 'PORQUE Iline NO DEPENDE DE LA LINEA QUE ESTE SINO DE DONDE ESTE '***

echa

'********************************************************** 'no tiene sentido 'en su lugar importante un capitulo o esta debajo de otro o debajo a la der If I_tipo = 0 Then I_tipo = 2 ElseIf I_tipo = 1 Then

VEL"

End If '********************************************************** If I_nivel = 0 And I_solopartidas = 1 Then MsgBox "NO SE PUEDEN MEZCLAR PARTIDAS y CAPITULOS CON PARTIDAS EN UN NI excel_amexcel = 1 Exit Function End If If ILine = 1 Then Hoja2.Cells(Li, 3 + I_nivel) = ILine If I_nivel = 0 Then Else Else End If

If I_nivel = 0 Then Else

i = -1 While ((Li + i) > 1 And (Hoja2.Cells(Li + i, 1) = "Error" Or Hoja2. Cells(Li + i, 1) = "LINEA DE TOTALES" Or Hoja2.Cells(Li + i, 1) = "Par" Or Trim(Hoja2.Cells(Li + i, 1) = ""))) i = i - 1 Wend hen

If Hoja2.Cells(Li + i, 3 + I_nivel).Value <> "" And (Li + i) <> 1 T Else Hoja2.Cells(Li, 3 + I_nivel) = ILine ILine = 1 I_tipo = 2 'AHORA SE PUEDE PONER CAPITULOS O PARTIDAS Hoja2.Cells(Li, 3 + I_nivel) = ILine

Mdulo8 - 3 End If End If End If

If I_nivel = 0 Then Hoja2.Cells(Li, 2) = ILine introducecapitulo (ILine), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_nivel = 1 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_nivel = 2 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 2) * 10000 + Hoja2.C ells(Li, 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel)

ElseIf I_nivel = 3 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 3) * 1000000 + Hoja2 .Cells(Li, 3 + I_nivel - 2) * 10000 + Hoja2.Cells(Li, 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_nivel = 4 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 4) * 100000000 + Hoj a2.Cells(Li, 3 + I_nivel - 3) * 1000000 + Hoja2.Cells(Li, 3 + I_nivel - 2) * 10000 + Hoja2.Cells(Li , 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_nivel = 5 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 5) * 10000000000# + Hoja2.Cells(Li, 3 + I_nivel - 4) * 100000000 + Hoja2.Cells(Li, 3 + I_nivel - 3) * 1000000 + Hoja2.C ells(Li, 3 + I_nivel - 2) * 10000 + Hoja2.Cells(Li, 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_nivel = 6 Then Hoja2.Cells(Li, 2) = Hoja2.Cells(Li, 3 + I_nivel - 6) * 1000000000000# + Hoja2.Cells(Li, 3 + I_nivel - 5) * 10000000000# + Hoja2.Cells(Li, 3 + I_nivel - 4) * 100000000 + Hoja2.Cells(Li, 3 + I_nivel - 3) * 1000000 + Hoja2.Cells(Li, 3 + I_nivel - 2) * 10000 + Hoja2.Cells (Li, 3 + I_nivel - 1) * 100 + ILine introducecapitulo (Hoja2.Cells(Li, 2)), Hoja2.Cells(Li, 10 + I_nivel) ElseIf I_tipo = 1 Then MsgBox "NO SE PUEDEN MEZCLAR CAPITULOS CON PARTIDAS EN UN NIVEL" excel_amexcel = 1 Exit Function End If ILine = ILine + 1 Else 'es partida

PARTIDAS

'PARTIDAS PARTIDAS PARTIDAS PARTIDAS PARTIDAS PARTIDAS If I_nivel > 0 Then If I_tipo = 0 Then MsgBox "NO SE PUEDEN PONER PARTIDAS SIN ESTAR DEBAJO DE CAPITULOS" excel_amexcel = 1 Exit Function Else I_tipo = 1 'Se ha escrito un concepto que es partida End If Else 'ES NIVEL 0 y SI ES EL PRIMER ASIENTO PARTIDA, TODO EL RESTO TIENEN QUE SER If Li = 2 Then I_solopartidas = 1 End If End If Hoja2.Cells(Li, 1) = "Par" 'tramitado y partida If I_tipo = 0 Then I_tipo = 1 ElseIf I_tipo = 2 And I_nivel <> 0 Then MsgBox "NO SE PUEDEN MEZCLAR CAPITULOS CON PARTIDAS EN UN NIVEL" excel_amexcel = 1 Exit Function End If

Mdulo8 - 4

If I_nivel = 0 And Li = 2 Then Li_temp = Li ILine = ILine + 1 Else Li_temp = Li While ((Li_temp - 1) >= 0 And (Hoja2.Cells(Li - 1, 1) = "Error" Or Hoja 2.Cells(Li - 1, 1) = "LINEA DE TOTALES")) Li_temp = Li_temp - 1 Wend End If If Hoja2.Cells(Li_temp - 1, 1) = "Par" Then Hoja2.Cells(Li, 2) = CDbl(Hoja2.Cells((Li_temp - 1), 2)) + 1 introducepartida (Hoja2.Cells(Li, 2)), Li, (10 + I_nivel) Hoja2.Cells(Li, 3 + I_nivel) = Hoja2.Cells(Li - 1, 3 + I_nivel) + 1 ElseIf Hoja2.Cells(Li_temp - 1, 1) = "C" Then Hoja2.Cells(Li, 2) = CDbl(Hoja2.Cells((Li_temp - 1), 2)) * 100 + 1 introducepartida (Hoja2.Cells(Li, 2)), Li, (10 + I_nivel) Hoja2.Cells(Li, 3 + I_nivel) = 1 End If 'ILine = ILine + 1 End If End If End If

Else

Loop

Wend j = Ifili_max - 2 'reiniciamos el numero de fila que hay que estudiar I_nivel = I_nivel + 1 I_tipo = 0

'ES UNA FILA QUE ESTA TRAMITADA I_tipo = 0 ' CON ESTO SE EVITA QUE UNA PARTIDA NO ESTE DEBAJO DE UN CAPITULO ' osea colgada por cualquier lado End If j = j - 1 Li = Li + 1

End Function Public Function generacodigocapitulo(ByVal I_value As Integer) As String generacodigocapitulo = Strings.format(I_value, "00000") End Function Public Sub introducepartida(ByVal DLii As Double, ByVal Lii As Integer, ByVal Ljj As Integer) Dim i As Integer 'Dim Lii_puntero_temp As Integer

a$ = "G" + generacodigocapitulo(Lii_partidas) i = 0 Do While (Not IsEmpty(Hoja2.Cells(i + Ipunterocodigos, 1).Value)) If Strings.Trim(Hoja2.Cells(i + Ipunterocodigos, 3)) = Trim(Hoja2.Cells(Lii, Ljj + 1)) Then Lii_partidas = Lii_partidas - 1 a$ = Trim(Hoja2.Cells(Ipunterocodigos + i, 1))

))

Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 1) = CDbl(DLii) Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 2) = a$ Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 8) = CDbl(Hoja2.Cells(Lii, Ljj + 2 Lii_partidas = Lii_partidas + 1 Lii_puntero_estructura = Lii_puntero_estructura + 1 Exit Sub

Mdulo8 - 5 End If i = i + 1 'Next i Loop Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 1) = CDbl(DLii) Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 2) = a$ Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 8) = CDbl(Hoja2.Cells(Lii, Ljj + 2))

Hoja2.Cells(Ipunterocodigos Hoja2.Cells(Ipunterocodigos Hoja2.Cells(Ipunterocodigos Hoja2.Cells(Ipunterocodigos Hoja2.Cells(Ipunterocodigos

+ + + + +

Lii_puntero, Lii_puntero, Lii_puntero, Lii_puntero, Lii_puntero,

1) 2) 3) 4) 5)

= = = = =

a$ Trim(Hoja2.Cells(Lii, Ljj)) Trim(Hoja2.Cells(Lii, Ljj + 1)) "P" CDbl(Hoja2.Cells(Lii, Ljj + 3))

Lii_partidas = Lii_partidas + 1 Lii_puntero = Lii_puntero + 1 Lii_puntero_estructura = Lii_puntero_estructura + 1 End Sub Public Sub introducecapitulo(ByVal DLii As Double, ByVal Scelda As String) b$ = Hoja7.Range("B10") a$ = b$ + generacodigocapitulo(Lii_codigo) Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 1) = CDbl(DLii) Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 2) = a$ Hoja2.Cells(Ipunteroestructura + Lii_puntero_estructura, 8) = CDbl(1) Hoja2.Cells(Ipunterocodigos + Lii_puntero, 1) = a$ Hoja2.Cells(Ipunterocodigos + Lii_puntero, 3) = Trim(Scelda) Hoja2.Cells(Ipunterocodigos + Lii_puntero, 4) = "C" Lii_codigo = Lii_codigo + 1 Lii_puntero_estructura = Lii_puntero_estructura + 1 Lii_puntero = Lii_puntero + 1 End Sub Public Function inicializa() As Integer Dim j As Double Dim Ifili_max As Integer Dim I_nivel As Integer Dim TopCell As Range Dim BottomCell As Range Dim Celda1 As Range Dim Celda2 As Range inicializa = 0 Lii_codigo = 1 Lii_partidas = 1 Lii_puntero = 0 Lii_puntero_estructura = 0 Hoja2.Activate If IsEmpty(Hoja2.Cells(1, 1)) Then MsgBox "LA PRIMERA FILA Y COLUMNA NO PUEDE ESTAR VACIA" Exit Function End If Borrarfilasvacias 'borra todas las filas vacias Rows("1:1").Select Selection.Insert Shift:=xlDown Columns("A:A").Select

Mdulo8 - 6 Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight j = 1 I_nivel = 0 Ifili_max = 0 I_nivelmax = 1 Do While I_nivel < 7 Set Celda1 = Hoja2.Cells(2, 10 + I_nivel) Set Celda4 = Hoja2.Cells(2, 10 + I_nivel) Hoja2.Range(Celda1, Celda4).Select Set TopCell = Cells(1, ActiveCell.Column) Set BottomCell = Cells(16384, ActiveCell.Column)

If IsEmpty(TopCell) Then Set TopCell = TopCell.End(xlDown) If IsEmpty(BottomCell) Then Set BottomCell = BottomCell.End(xlUp) If TopCell.Row = 16384 And BottomCell.Row = 1 Then ActiveCell.Select Else Range(TopCell, Bottom Cell).Select j = Selection.Rows.Count 'numero de filas con informacion (vacias o llenas) Li = ActiveCell.Row 'fila de comienzo If j > 5000 Then j = 0 I_nivelmax = I_nivel If I_nivel = 0 Then Else Exit Function

Else

Exit Do End If

End If If Ifili_max < j + Li Then Ifili_max = j + Li End If I_nivel = I_nivel + 1 Loop inicializa = Ifili_max Ipunteroestructura = Ifili_max + 4 Ipunterocodigos = Ifili_max + 4 + Ifili_max + 100 End Function Public Function Aparece_totales(ByVal Texto As String) As Integer Aparece_totales = 0 'no aparece If InStr(1, "TOTAL", Texto) <> 0 Then Aparece_totales = 1 ElseIf InStr(1, "total", Texto) <> 0 Then Aparece_totales = 1 End If

Mdulo8 - 7

End Function Public Function capituloopartida(ByVal Texto As String) As Integer 'Dim vuelta As Integer Dim a As String Dim c As String Dim b As String Dim d As String 'el nuemero Dim e As String Dim n As Integer Dim centinela As Integer 'PARA QUE SEA PARTIDA TIENE QUE TENER UNIDAD (MENOR DE TRES CARACTERES) Y LA SIGUIENTE CELDA DERECH A MAS DE TRES CARACTERES capituloopartida = 0 If Len(Trim(Texto)) > 3 Then capituloopartida = 1 'es capitulo Else End If End Function Public Sub Borrarfilasvacias() Dim j As Double Dim i As Integer Dim Ifili_max As Integer Dim I_nivel As Integer Dim I_nivelmax As Integer I_nivel = 0 Do While I_nivel < 7 Set Celda1 = Hoja2.Cells(1, 1 + I_nivel) Set Celda4 = Hoja2.Cells(1, 1 + I_nivel) Hoja2.Range(Celda1, Celda4).Select Set TopCell = Cells(1, ActiveCell.Column) Set BottomCell = Cells(16384, ActiveCell.Column)

If IsEmpty(TopCell) Then Set TopCell = TopCell.End(xlDown) If IsEmpty(BottomCell) Then Set BottomCell = BottomCell.End(xlUp) If TopCell.Row = 16384 And BottomCell.Row = 1 Then ActiveCell.Select Else Range(TopCell, Bottom Cell).Select j = Selection.Rows.Count Li = ActiveCell.Row If j > 5000 Then j = 0 I_nivelmax = I_nivel If I_nivel = 0 Then Exit Sub Else Exit Do End If End If If Ifili_max < j + Li Then Ifili_max = j + Li End If Loop I_nivel = I_nivel + 1

j = Ifili_max - 2 i = 1 While (j <> 0) Do While (i < 7 And IsEmpty(Hoja2.Cells(j, i)) = True) i = i + 1

Mdulo8 - 8 Loop If i = 7 Then Hoja2.Cells(j, 1) = "limpiar" i = 1 j = j - 1

Wend j = Ifili_max - 2 While (j <> 0) If Hoja2.Cells(j, 1) = "limpiar" Then Rows(j).Delete Shift:=xlUp End If Wend j = j - 1

End Sub Public Sub exporta_bc3() 'ACTUALIZADO EL 27 DE MAYO Dim i, j, m As Double Dim Bdescomposicion As Boolean Dim venta As Double Dim medicion As Double Dim D_base As Double Dim S_codigo As String Dim stemp1 As String Dim SDa, SDb, SDc, SDd As String Dim SS As String Dim Smed As String Dim Dposicionmedicion As Double Dim FilesNewPath$ Dim yz As String Dim fs, zs, ns, ls, os, ps, qs, ws, ys As String Dim Ts As String Dim sas As String Dim CurrentCell As Range Dim NextCell As Range Dim filtro As String Dim l As Double Dim LValue As Date Dim SDate As String LValue = Date SDate = format(Date, "ddmmyyyy") FilesNewPath = ActiveWorkbook.path & "\" zs ws ns ls os ps qs = = = = = = = Hoja7.Range("B1") "~V||FIEBDC-3/2002\" + SDate + "|Mexcel beta 0.1|\|ANSI|" "~K|0\2\2\3\2\2\2\2\EUR\|0\0\0\0\16\|2\2\0\-6\3\-6\2\2\2\-6\2\2\EUR\||" "~C|" "~D|" "~T|" "~M|"

If Tituloarchivobc3 = "" Then fs = FilesNewPath + "mexcel.bc3" Else fs = FilesNewPath + Tituloarchivobc3 + ".bc3" End If Open fs For Output As #2 Print #2, ws Print #2, ns sas = ls + "R_A_I_Z##||" + zs + "|" + Strings.Trim(Hoja4.Cells(ipuntero + 1, 5)) + "|" + SDate + "|OB|" Print #2, sas Hoja4.Activate Set CurrentCell = Hoja4.Cells(ipuntero + 2, 1)

Mdulo8 - 9 While CurrentCell.Value <> ""

Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Offset(0, 3).Value = "C" Then filtro = CurrentCell.Value If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If i = 1 venta = 0 Do While Hoja4.Cells(i, 1) <> "" If Hoja4.Cells(i, 2) = CurrentCell.Value Then venta = Hoja4.Cells(i, 7) Exit Do End If i = i + 1 Loop sas = ls + fs + "#||" + CurrentCell.Offset(0, 2).Value + "|" + Trim(Str(venta)) + "|" + SDa te + "||" Else Print #2, sas If CurrentCell.Offset(0, 4).Value = "" Then 'el precio de venta ys = "" Else venta = CurrentCell.Offset(0, 4).Value ys = Trim(Str(venta)) End If

yz = "" If CurrentCell.Offset(0, 3).Value = "mat" Then 'tipo de concepto (mat, mo, maq) yz = "3" ElseIf CurrentCell.Offset(0, 3).Value = "mo" Then yz = "1" ElseIf CurrentCell.Offset(0, 3).Value = "maq" Then yz = "2" ElseIf CurrentCell.Offset(0, 3).Value = "%" Then yz = "%" Else 'yz = "EU" yz = "" End If sas = ls + CurrentCell.Value + "|" + Strings.Trim(CurrentCell.Offset(0, 1).Value) + "|" + S trings.Trim(CurrentCell.Offset(0, 2).Value) + "|" + ys + "|" + SDate + "|" + yz + "|" Print #2, sas End If Set CurrentCell = NextCell

Wend

'******************************************************************************** '* '* SEGUNDO EL DESCOMPUESTO DEL RAIZ '* '******************************************************************************** '~D|R_A_I_Z##|PNC108120\\\PNC108121\\\PNC108122\\\PNC108140\\\PNC108150\\\PNC108151\\\PNC108160\\\P NC108210\\\PNC108501\\\PNC108502\\\PNC108503\\\PNC108115\\\CAP2#\\\| Set CurrentCell = Hoja4.Cells(1, 1) sas = os + "R_A_I_Z##|" '~D|CAP1#|DESB\\10000.000\EXCV\\1000.000\| '~D|R_A_I_Z##|CAP1#\\1.000\CAP2#\\1.000\| '~D|PS_1#|HORL\\10.000\| For i = 1 To 99 Do While CurrentCell.Value <> "" medicion = 0 Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Value = i Then 'NO PUEDEN APARECER EL SIMBOLO # AL FINAL.

Mdulo8 - 10 filtro = CurrentCell.Offset(0, 1).Value If InStr(1, "#", Strings.Right(filtro, 1)) fs = Strings.Left(filtro, (Len(filtro) ElseIf InStr(1, "#", Strings.Right(filtro, fs = Strings.Left(filtro, (Len(filtro) Else fs = filtro = 1 Then - 1)) 2)) = 2 Then - 2))

End If If CurrentCell.Offset(0, 7).Value = "" Then Smed = "" Else medicion = CurrentCell.Offset(0, 7).Value Smed = Trim(Str(medicion)) End If For m = 1 To IConceptos If Hoja4.Cells(m + ipuntero + 1, 1) = CurrentCell.Offset(0, 1).Value Then Exit For End If Next m If Hoja4.Cells(m + ipuntero + 1, 4) <> "C" Then sas = sas + fs + "\\" + Smed + "\" Else 'es un capitulo sas = sas + fs + "#\\" + Smed + "\" End If Set CurrentCell = Hoja4.Cells(1, 1) Exit Do End If Set CurrentCell = NextCell Loop Set CurrentCell = Hoja4.Cells(1, 1) Next i sas = sas + "|" Print #2, sas '******************************************************************************** '* '* TERCERO EL RESTO DE DESCOMPUESTOS '* '******************************************************************************** Set CurrentCell = Hoja4.Cells(1, 1) i = 1 '~D|CAP1#|DESB\\10000.000\EXCV\\1000.000\| '~D|R_A_I_Z##|CAP1#\\1.000\CAP2#\\1.000\| '~D|PS_1#|HORL\\10.000\| While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(1, 0)

For m = 1 To IConceptos If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 1)) = Strings.Trim(CurrentCell.Offset(0, 1).V alue) Then Exit For End If Next m If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 4)) = "C" Then filtro = CurrentCell.Offset(0, 1).Value If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If sas = os + fs + "#|" D_base = CurrentCell.Value For i = 1 To 99

Mdulo8 - 11

j = 1 Do While Hoja4.Cells(j, 1) <> "" If CDbl(Hoja4.Cells(j, 1)) = (D_base * 100 + i) Then For m = 1 To IConceptos If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(j, 2)) Then Exit For End If Next m filtro = Hoja4.Cells(j, 2) If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 4)) = "C" Then sas = sas + fs + "#\\" + Trim(Str(Hoja4.Cells(j, 8))) + "\" Exit Do Else sas = sas + fs + "\\" + Trim(Str(Hoja4.Cells(j, 8))) + "\" Exit Do End If End If j = j + 1

Loop

Else ' es partida End If Wend

Next i sas = sas + "|" Print #2, sas

Set CurrentCell = NextCell

'******************************************************************************** '* '* CUARTO EL TEXTO p$ = "~T|" '* '******************************************************************************** Set CurrentCell = Hoja4.Cells(ipuntero + 2, 1) '~T|R_A_I_Z##|EN UN LUGAR DE LA MANCHA| '~T|DESB|DESBROCE HASTA 30 CM. DE PROFUNDIDAD. TRASLADO A VERTEDERO.| While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(1, 0) If CurrentCell.Offset(0, 3).Value = "C" Then filtro = CurrentCell.Value If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If If CurrentCell.Offset(0, 5).Value <> "" Then sas = ps + fs + "#|" + CurrentCell.Offset(0, 5).Value + "|" Print #2, sas End If Else 'partidas If CurrentCell.Offset(0, 5).Value <> "" Then sas = ps + CurrentCell.Value + "|" + CurrentCell.Offset(0, 5).Value + "|" Print #2, sas End If End If Set CurrentCell = NextCell

Wend

Mdulo8 - 12 '******************************************************************************** '* '* QUINTO EL DESCOMPUESTO DE LA MEDICION EN LA RAIZ '* '******************************************************************************** sas = qs + "R_A_I_Z##\" Itipo_de_proyecto = 0 'Dcontador = 0 '~M|R_A_I_Z##\TEER|3|8.00|\\1\2.00\2.00\2.00\| '~M|R_A_I_Z##\EXCV|2|3.00|\\1\1.00\\1.00\\\2\1.00\\1.00\| For i = 1 To 99 j = 1 Do While Hoja4.Cells(j, 1) <> "" medicion = 0 If CDbl(Hoja4.Cells(j, 1)) = i Then If Hoja4.Cells(j, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then 'tiene medicin descompuesta stemp1 = Hoja4.Cells(j, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal Dposicionmedicion = SolamenteNumeros(stemp1) For m = 1 To IConceptos If Hoja4.Cells(m + ipuntero + 1, 1) = Hoja4.Cells(j, 2) Then Exit For End If Next m If Hoja4.Cells(m + ipuntero + 1, 4) <> "C" Then medicion = CDbl(Hoja4.Cells(j, 8)) l = 1 Ts = "" Hoja1.Activate Do While CDbl(Hoja1.Cells(l + Dposicionmedicion + 1, 3 + pos_med_col)) <> 0 filtro = Hoja4.Cells(m + ipuntero + 1, 1) If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If If Hoja1.Cells(l + Dposicionmedicion + 1, 10 + pos_med_col) = "" Then '~M|R_A_I_Z##\EXCV|2|3.00|\que pasa\1\1.00\\1.00\\hola\2\1.00\\1.00\| l)) 'texto ) ) ) ) " l)) ) )) Else

SS = Strings.Trim(Hoja1.Cells(l + Dposicionmedicion + 1, 4 + pos_med_co

SDa = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 5 + pos_med_col))

SDb = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 6 + pos_med_col))

SDc = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 7 + pos_med_col))

SDd = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 8 + pos_med_col))

Ts = Ts + "\" + SS + "\" + SDa + "\" + SDb + "\" + SDc + "\" + SDd + "\

SS = Strings.Trim(Hoja1.Cells(l + Dposicionmedicion + 1, 4 + pos_med_co

SDa = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 5 + pos_med_col))

SDb = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 11 + pos_med_col)

"

SDc = "" SDd = "" Ts = Ts + "\" + SS + "\" + SDa + "\" + SDb + "\" + SDc + "\" + SDd + "\ End If l = l + 1

"

Loop Hoja4.Activate sas = sas + fs + "|" + Trim(Str(i)) + "|" + Trim(Str(medicion)) + "|" + Ts + "|

Mdulo8 - 13 Print #2, sas Exit Do End If End If End If j = j + 1 Loop sas = qs + "R_A_I_Z##\" Next i '******************************************************************************** '* '* SEXTO EL DESCOMPUESTO DE LA MEDICION EN TODOS LOS CAPITULOS '* '******************************************************************************** Set CurrentCell = Hoja4.Cells(1, 1) i = 1 '~D|R_A_I_Z##|cap1#\\1.000\cap2#\\1.000\| '~D|cap2#|fer\\2.000\car\\13.000\edu\\800.000\| '~M|cap2#\fer|2\1|2.00|\\1\\\\\99999\1\1.00\\\| '~M|cap2#\edu|2\3|800.00|\Linea 1\1\\\\\Linea 2\1\799.00\\\| '~M|cap1#\edu|1\3|4.00|\\3\\\\\Hola\1\\\\| While CurrentCell.Value <> "" Set NextCell = CurrentCell.Offset(1, 0)

For m = 1 To IConceptos If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 1)) = Strings.Trim(CurrentCell.Offset(0, 1).V alue) Then Exit For End If Next m If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 4)) = "C" Then 'es capitulo filtro = CurrentCell.Offset(0, 1).Value If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If sas = qs + fs + "#\" D_base = CurrentCell.Value For i = 1 To 99 j = 1 Do While Hoja4.Cells(j, 1) <> "" medicion = 0 If CDbl(Hoja4.Cells(j, 1)) = (D_base * 100 + i) Then If Hoja4.Cells(j, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then '* stemp1 = Hoja4.Cells(j, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) Dposicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 '* For m = 1 To IConceptos If Strings.Trim(Hoja4.Cells(m + ipuntero + 1, 1)) = Strings.Trim(Hoja4. Cells(j, 2)) Then Exit For End If Next m If Hoja4.Cells(m + ipuntero + 1, 4) <> "C" Then

medicion = CDbl(Hoja4.Cells(j, 8)) l = 1 Ts = "" Hoja1.Activate Do While Hoja1.Cells(l + Dposicionmedicion + 1, 4 + pos_med_col) <> "" Or Hoja1.Cells(l + Dposicionmedicion + 1, 5 + pos_med_col) <> "" Or Hoja1.Cells(l + Dposicionmedici

Mdulo8 - 14 on + 1, 6 + pos_med_col) <> "" Or Hoja1.Cells(l + Dposicionmedicion + 1, 7 + pos_med_col) <> "" Or Hoja1.Cells(l + Dposicionmedicion + 1, 8 + pos_med_col) <> "" Or Hoja1.Cells(l + Dposicionmedicion + 1, 10 + pos_med_col) <> "" en 1.00\| s_med_col)) 'texto ed_col))) ed_col))) ed_col))) ed_col))) SDd + "\" s_med_col)) ed_col))) med_col))) Else

If Hoja1.Cells(l + Dposicionmedicion + 1, 10 + pos_med_col) = "" Th

'~M|R_A_I_Z##\EXCV|2|3.00|\que pasa\1\1.00\\1.00\\hola\2\1.00\\

SS = Strings.Trim(Hoja1.Cells(l + Dposicionmedicion + 1, 4 + po

SDa = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 5 + pos_m

SDb = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 6 + pos_m

SDc = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 7 + pos_m

SDd = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 8 + pos_m Ts = Ts + "\" + SS + "\" + SDa + "\" + SDb + "\" + SDc + "\" +

SS = Strings.Trim(Hoja1.Cells(l + Dposicionmedicion + 1, 4 + po

SDa = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 5 + pos_m

SDb = Trim(Str(Hoja1.Cells(l + Dposicionmedicion + 1, 11 + pos_ SDc = "" SDd = "" Ts = Ts + "\" + SS + "\" + SDa + "\" + SDb + "\" + SDc + "\" + End If l = l + 1

SDd + "\"

Ts + "|"

Loop Hoja4.Activate filtro = Hoja4.Cells(m + ipuntero + 1, 1) If InStr(1, "#", Strings.Right(filtro, 1)) = 1 Then fs = Strings.Left(filtro, (Len(filtro) - 1)) ElseIf InStr(1, "#", Strings.Right(filtro, 2)) = 2 Then fs = Strings.Left(filtro, (Len(filtro) - 2)) Else fs = filtro End If sas = sas + fs + "|" + Trim(Str(i)) + "|" + Trim(Str(medicion)) + "|" + Print #2, sas Exit Do End If End If End If j = j + 1

Loop 'RECUERDA AQUI filtro = CurrentCell.Offset(0, 1).Value If InStr(1, "#", Strings.Right(filtro, 1)) fs = Strings.Left(filtro, (Len(filtro) ElseIf InStr(1, "#", Strings.Right(filtro, fs = Strings.Left(filtro, (Len(filtro) Else fs = filtro End If sas = qs + fs + "#\" Next i Else ' es partida '~D|HORL|HOR100\\1.020\MO_PEON\\0.020\| 'FALTA EL CODIGO DE LA DESCOMPOSICION DE PARTIDAS End If Wend Set CurrentCell = NextCell

= 1 Then - 1)) 2)) = 2 Then - 2))

Mdulo8 - 15 '******************************************************************************** '* '* SEPTIMO DESCOMPUESTO DE PARTIDAS '* '******************************************************************************** 'Set CurrentCell = Hoja4.Cells(ipuntero + 2, 1) ' es partida '~D|CAP1#|DESB\\10000.000\EXCV\\1000.000\| '~D|HORL|HOR100\\1.020\MO_PEON\\0.020\| 'ESTE ES EL CODIGO DE LA DESCOMPOSICION DE PARTIDAS j = 0 While Hoja4.Cells(ipuntero + 2 + j, 1) <> "" sas = os If Hoja4.Cells(ipuntero + 2 + j, 4) = "P" Or Hoja4.Cells(ipuntero + 2 + j, 4) = "" Then Bdescomposicion = False i = 0 Do While Hoja4.Cells(ipuntero + 2 + j, 100 + i * 4) <> "" '~V||FIEBDC-3/2002\170709|Menfis 6.4.2|\|ANSI| '~K|0\2\2\3\2\2\2\2\EUR\|0\0\0\0\16\|2\2\0\-6\3\-6\2\2\2\-6\2\2\EUR\|| '~C|%CI|%|Costes Indirectos|||%| '~C|R_A_I_Z##||||170709|| '~C|coef%||Costes indirectos||170709|%| '~C|exc0001||Excavacion de tierra vegetal|3.18|170709|| '~C|mopeon||Peon|15|170709|1| '~D|R_A_I_Z##|exc0001\\\| '~D|exc0001|mopeon\\0.200\%CI\\0.060\| '~T|%CI|Costes Indirectos| 'HAY DESCOMPOSICION If Bdescomposicion = False Then Bdescomposicion = True sas = sas + Strings.Trim(Hoja4.Cells(ipuntero End If sas = sas + Strings.Trim(Hoja4.Cells(ipuntero + 2 If Hoja4.Cells(ipuntero + 2 + j, 100 + i * 4 + 1) sas = sas + "" + "\" Else sas = sas + Trim(Str(Hoja4.Cells(ipuntero + 2 End If i = i + 1 Loop If Bdescomposicion Then sas = sas + "|" Print #2, sas End If End If Wend j = j + 1

+ 2 + j, 1)) + "|" + j, 100 + i * 4)) + "\\" = "" Then + j, 100 + i * 4 + 1))) + "\"

Close #2 End Sub

Public Sub inicializar_exportacion() 'se encarga de poner las variables del presupuesto y sumar para paras posteriormente a la exportaci on Dim j As Integer Dim stemp1 As String Dim Stemp2 As String Dim stemp3 As String Base = 0 Sposicion = 0 ipuntero = Hoja7.Range("B23") ordenarconcepto Itipo_de_proyecto = 0

ordenarconcepto

Mdulo8 - 16 Sumartodo

End Sub

Mdulo9 - 1 '**************************************************************************** '* '* MODULO DE PRESENTACION DE INFORMES '* '***************************************************************************** Option Explicit

'**************************************************************** ' FERNANDO GARCIA PEREZ. SAN SEBASTIAN. ESPAA 'Licencia GPL (Licencia Pblica General GNU, tambin conocida como simplemente GNU). 'Mexcel conserva los derechos de autor (copyright), y permite la redistribucin y modificacin, 'pero controlando que todas las versiones modificadas del software permanecen bajo los trminos ms restrictivos de la propia licencia GNU GPL 'Version 1.0.0. .------. '29 de Julio de 2010 '**************************************************************** Public B_edit_inf_paralelo As Boolean Public B_Pres_Solo_Con_Precio As Boolean Public B_Pres_Solo_Con_Medicion As Boolean Public B_Solo_texto_resumido As Boolean Public IFlagposition1 As Integer Public IFlagposition2 As Integer Public IFlagposition3 As Integer Public IFlagposition4 As Integer Public IFlagposition5 As Integer Public IFlagposition6 As Integer Public IFlagposition7 As Integer Public Sub Macro_exportar_word() Dim wordApp As Object Dim wordDoc As Object Dim apliword As Object Dim inumverline As Double Dim Dmarcainicio As Double Dim Rkey As Range Dim BottomCell As Range Set apliword = CreateObject("word.application") Set wordApp = CreateObject("Word.Application") Set wordDoc = wordApp.documents.Add

Hoja5.Activate 'Aqu debes especificar el rango a copiar 'Worksheets("julio").Range("cat").Select 'Application.Selection.Copy inumverline = 14679 Dmarcainicio = inumverline + 1 Do While inumverline < 15000 '15000 inumverline = inumverline + 1 If Hoja5.Cells(inumverline, 1) = "s" Then Set Rkey = Hoja5.Cells(Dmarcainicio, 3) Set BottomCell = Hoja5.Cells(inumverline - 1, 10) Range(Rkey, BottomCell).Select Selection.Copy 'Rkey.Select

Dmarcainicio = inumverline wordApp.Visible = True wordApp.Selection.PasteSpecial Link:=False, DataType:=1, Placement:=0, DisplayAsIcon:=False wordApp.Selection.InsertBreak Type:=8 '7 'wdPageBreak '1 SALTO PAGINA '2 SALTO PAGINA SECCION '3 SALTO SECCION CONTINUA '4 SALTO SECCION PAGINA PAR '5 SALTO SECCION PAGINA IMPAR '6 RETORNO DE CARRO CTRL+ENTER ' 7 SALTO DE PAGINA

Mdulo9 - 2 '8 SALTO DE COLUMNA

End If Loop apliword.Quit

End Sub Public Sub Macro_editarinformes() Application.ScreenUpdating = False Informes.Show Hoja5.Activate

End Sub Public Sub Macro_limpiarhoja1() Dim Mensaje As Integer Application.ScreenUpdating = False Hoja5.Activate ActiveSheet.Select 'todo el contenido de la hoja, incluyendo los formatos de las celdas!!! Mensaje = MsgBox(Chr(13) + " Se borrarn todos los datos de la hoja de clculo, _ Chr(13) + " incluyendo el formato de las celdas. " + _ Chr(13) + Chr(13) + " Ests seguro de querer continuar?. " + _ Chr(13) + Chr(13), vbYesNo, " INFORMACIN") If Mensaje = vbYes Then 'celda_donde_estamos = ActiveCell.Address Cells.Select 'Borramos la seleccin efectuada, incluyendo los formatos de celda Selection.Delete Shift:=xlUp 'esta lnea cambia, si solo queremos borrar el contenido 'Range(celda_donde_estamos).Select End If Application.ScreenUpdating = True End Sub Public Sub Macro_limpiarhoja() Hoja5.Activate Cells.Select Selection.ClearContents Selection.ColumnWidth = 12 With Selection .NumberFormat = "General" .HorizontalAlignment = xlGeneral .VerticalAlignment = xlTop .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection.Font .Name = "Arial" .FontStyle = "Normal"

" +

Mdulo9 - 3 .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Selection.Interior.ColorIndex = xlNone End Sub Public Sub Macro_autofiltro() 'macro que se encarga de seleccionar el ltimo informe en la tabla. 'finalmente le aplica un autofiltro para trabajar con el presupuesto. Dim nfilas As Long Dim ncolumnas As Integer Dim Rinicio, RightCell As Range Dim Rkey As Range Dim LeftCell As Range Dim TopCell As Range Dim BottomCell As Range Hoja5.Activate Application.ScreenUpdating = True If IsEmpty(Hoja5.Cells(5, 1)) Then 'no hay conceptos luego no se ordena y nos vamos Else

Set Rkey = Hoja5.Cells(5, 1) Rkey.Select Set LeftCell = Cells(ActiveCell.Row, 1) Set RightCell = Cells(ActiveCell.Row, 256)

If IsEmpty(LeftCell) Then Set LeftCell = LeftCell.End(xlToRight) If IsEmpty(RightCell) Then Set RightCell = RightCell.End(xlToLeft) If LeftCell.Column = 256 And RightCell.Column = 1 Then ActiveCell.Select Else Range(LeftCell, R ightCell).Select ncolumnas = Selection.Columns.Count Set TopCell = Cells(1, ActiveCell.Column) Set BottomCell = Cells(16384, ActiveCell.Column)

If IsEmpty(TopCell) Then Set TopCell = TopCell.End(xlDown) If IsEmpty(BottomCell) Then Set BottomCell = BottomCell.End(xlUp) If TopCell.Row = 16384 And BottomCell.Row = 1 Then ActiveCell.Select Else Range(TopCell, Bottom Cell).Select nfilas = Selection.Rows.Count + 10 Set Rkey = Hoja5.Cells(5, 1) Set BottomCell = Cells(nfilas, ncolumnas) Range(Rkey, BottomCell).Select Selection.AutoFilter End If Application.ScreenUpdating = False End Sub Public Sub restaurarocultar() Dim i As Integer

Mdulo9 - 4 Hoja5.Activate i = 2 Rows("1:1000").Select Selection.EntireRow.Hidden = False Columns("A:K").Select Selection.EntireColumn.Hidden = False End Sub Public Sub presenta_cp2ADIF(ByVal Lii As Integer, ByVal filtro As String) 'Lii es el numero de decimales de trabajo Dim Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto Dim ar As String Dim br As String Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Bnoentro As Boolean 'para el caso que solo tenga precio y no descompuesto i As Double, j As Double numeros As Double Dnumeros As Double Ilocaliza As Integer Drend As Double 'EL RENDIMIENTO Deditarimporte As Double Deditarimporte2 As Double Dotrosconceptos As Double Dotrosconceptos2 As Double Deditartotalimporte As Double Deditartotalimporte2 As Double

Dim Dtemp1 As Double Dim Dtemp2 As Double Dim stem1 As String Dim DK As Double 'coef de revision Dim Bcuidado As Boolean Dim Bpasa As Boolean Dim Dim Dim Dim NextCell As Range CurrentCell As Range RightCell As Range LeftCell As Range

Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Bcuidado = False numeros = 5 'numero de inicio de presentacion de lnea Dnumeros = 1 DK = 1 ' = 0.99015164 x 0,78589999 Set CurrentCell = NextCell Hoja5.Activate While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) ar = Hoja4.Cells(posicionconcepto, 1) 'codigo stem1 = 0 If filtro = "*" And Hoja4.Cells(posicionconcepto, 4) = "P" Then Bpasa = True ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", filtro) = 2 Then

Mdulo9 - 5 ' br br If ejemplo *mon* = Strings.Right(filtro, Len(filtro) - 1) ' mon* = Strings.Left(filtro, Len(filtro) - 1) ' mon InStr(1, br, ar) <> 0 Then Bpasa = True End If en

ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Left(filtro, 1)) = 1 Th

hen

'*hola br = Strings.Right(filtro, Len(filtro) - 1) 'hola If br = Strings.Right(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Right(filtro, 1)) = 1 T 'hola* br = Strings.Left(filtro, Len(filtro) - 1) 'hola If br = Strings.Left(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And ar = filtro Then Bpasa = True Else Bpasa = False End If If Bpasa Then Bpasa = False Hoja5.Cells(numeros, 1) = "par" Hoja5.Cells(numeros, 2) = Strings.Trim(Dnumeros) Dnumeros = Dnumeros + 1 Hoja5.Cells(numeros, 3) = Hoja4.Cells(posicionconcepto, 1) Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 2) Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Set RightCell = Cells(numeros, 5) Set LeftCell = Cells(numeros, 7) Range(RightCell, LeftCell).Merge Hoja5.Cells(numeros, 5).VerticalAlignment = xlTop Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Rows(numeros).HorizontalAlignment = xlJustify Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 3) 'resumen

'codigo 'unidad

Bdescomposicion = False Bnoentro = False Dotrosconceptos = 0 Deditartotalimporte = 0 Deditartotalimporte2 = 0 Dotrosconceptos = 0 Dotrosconceptos2 = 0 Drend = 0 stem1 = 0 i = 0 If B_Solo_texto_resumido = False Then numeros = numeros + 1 Set RightCell = Cells(numeros, 5) Set LeftCell = Cells(numeros, 9) Range(RightCell, LeftCell).Merge Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 1) = "tl" Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 6) End If numeros = numeros + 2 If Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "" Then Bnoentro = True Do While Hoja4.Cells(posicionconcepto, 100 + i * 4) <> ""

Mdulo9 - 6 If Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "nuevalinea" Then 'primero el rendimiento If Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1) <> "" Then Drend = CDbl(Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1)) ' aqui la Else

medicin

Drend = 0 Deditarimporte = 0

End If For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. Cells(posicionconcepto, 100 + i * 4)) Then Exit For End If Next j If Hoja4.Cells(j + ipuntero + 1, 4) = "%" Then Deditarimporte = Round(Deditartotalimporte * Drend, Lii)

, Lii)

Deditartotalimporte = Deditartotalimporte + Deditarimporte Deditartotalimporte2 = Deditartotalimporte2 + Round(Deditarimporte * DK Dotrosconceptos = Dotrosconceptos + Deditarimporte Dotrosconceptos2 = Dotrosconceptos2 + Round(Deditarimporte * DK, Lii) ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "mat" Then Bdescomposicion = True Hoja5.Cells(numeros, 1) = "mat" Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5))

Hoja5.Cells(numeros, 6) = Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 3) ) ' texto resumen maximo 50 letras Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Deditarimporte = Round(Deditarimporte * Drend, Lii) Hoja5.Cells(numeros, 7) = Deditarimporte Hoja5.Cells(numeros, 9).NumberFormat = format(Lii)

, Lii) quier cosa

Hoja5.Cells(numeros, 9) = Round(Deditarimporte * DK, Lii) Dtemp1 = Dtemp1 + CDbl(Hoja5.Cells(numeros, 9)) Deditartotalimporte = Deditartotalimporte + Round(Deditarimporte, Lii) Deditartotalimporte2 = Deditartotalimporte2 + Round(Deditarimporte * DK

numeros = numeros + 1 ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "" Then 'consideramos que es cual 'vacio--> NO SE TRAMITA

, Lii)

ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "&&" Then 'REDONDEO 'EL REDONDEO SI SE MULTIPLIA, PERO SE METE EN OTROS CONCEPTOS Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) Deditarimporte = Round(Deditarimporte * Drend, Lii) Deditartotalimporte = Deditartotalimporte + Deditarimporte Deditartotalimporte2 = Deditartotalimporte2 + Round(Deditarimporte * DK Dotrosconceptos = Dotrosconceptos + Deditarimporte Dotrosconceptos2 = Dotrosconceptos2 + Round(Deditarimporte * DK, Lii) ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then 'CAPITULOS 'EN CAPITULOS; NO HACEMOS NADA Else 'mo, maq, PARTIDAS Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5))

, Lii)

Deditarimporte = Round(Deditarimporte * Drend, Lii) Deditartotalimporte = Deditartotalimporte + Deditarimporte Dotrosconceptos = Dotrosconceptos + Deditarimporte Deditartotalimporte2 = Deditartotalimporte2 + Round(Deditarimporte * DK Dotrosconceptos2 = Dotrosconceptos2 + Round(Deditarimporte * DK, Lii)

Mdulo9 - 7 End If i = i + 1 Else Deditarimporte = 0

Loop Else ' no tiene descomposicin

' Aqui no hay descompuesto End If

tos

End If If Bdescomposicion Then 'OTROS CONCEPTOS 'puede existir errores de redondeo entre la suma de la multiplicacion de los descompues 'y el redondeo del total por el coef actualizacion 'para ello se pune un redondeo en caso de que haga faLta Hoja5.Cells(numeros, 1) = "oc" Hoja5.Cells(numeros, 6) = "OTROS CONCEPTOS" Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros, 7) = Dotrosconceptos Hoja5.Cells(numeros, 9).NumberFormat = format(Lii) 'Hoja5.Cells(numeros, 9) = Dotrosconceptos2 stem1 = "=REDONDEAR(" & (Dotrosconceptos2) & ";2)" Hoja5.Cells(numeros, 9).FormulaLocal = stem1 Dtemp1 = Dtemp1 + CDbl(Hoja5.Cells(numeros, 9)) Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros + + + + 3, 3, 3, 3, 1) = "t" 6) = "TOTAL" 7).NumberFormat = format(Lii) 7) = Deditartotalimporte

Hoja5.Cells(numeros + 3, 9).NumberFormat = format(Lii) stem1 = "=REDONDEAR(" & (Deditartotalimporte2) & ";2)" Hoja5.Cells(numeros + 3, 9).FormulaLocal = stem1 Dtemp2 = CDbl(Hoja5.Cells(numeros + 3, 9)) If Dtemp2 <> Dtemp1 And Abs(Dtemp2 - Dtemp1) > 0.0001 Then stem1 = "=REDONDEAR(" & (Dtemp2 - Dtemp1) & ";2)" Hoja5.Cells(numeros + 1, 9).FormulaLocal = stem1 Hoja5.Cells(numeros + 1, 6) = "REDONDEO" End If Hoja5.Rows(numeros + 3).Font.Bold = True Hoja5.Rows(numeros + 3).Font.Italic = True Else 'SIN MATERIALES If Bnoentro Then 'CON DESCOMPUESTO SIN MATERIALES Hoja5.Cells(numeros, 1) = "cdsm" Hoja5.Cells(numeros, 6) = "SIN DESCOMPOSICION" Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros, 7) = Deditartotalimporte Hoja5.Cells(numeros, 9).NumberFormat = format(Lii) Hoja5.Cells(numeros, 9) = Deditartotalimporte2 Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros + + + + + + 3, 3, 3, 3, 3, 3, 1) = "t" 6) = "TOTAL" 7).NumberFormat = format(Lii) 7) = Deditartotalimporte 9).NumberFormat = format(Lii) 9) = Deditartotalimporte2

Hoja5.Rows(numeros + 3).Font.Bold = True Hoja5.Rows(numeros + 3).Font.Italic = True Else 'SIN DESCOMPUESTO PERO CON PRECIO Deditartotalimporte = Hoja4.Cells(posicionconcepto, 5) Deditartotalimporte = Round(Deditartotalimporte, Lii) Deditartotalimporte2 = Round(Deditartotalimporte * DK, Lii) Hoja5.Cells(numeros, 1) = "sd" Hoja5.Cells(numeros, 6) = "SIN DESCOMPOSICION" Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros, 7) = Deditartotalimporte Hoja5.Cells(numeros, 9).NumberFormat = format(Lii) Hoja5.Cells(numeros, 9) = Deditartotalimporte2

Mdulo9 - 8 Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros Hoja5.Cells(numeros + + + + + + 3, 3, 3, 3, 3, 3, 1) = "t" 6) = "TOTAL" 7).NumberFormat = format(Lii) 7) = Deditartotalimporte 9).NumberFormat = format(Lii) 9) = Deditartotalimporte2

Hoja5.Rows(numeros + 3).Font.Bold = True Hoja5.Rows(numeros + 3).Font.Italic = True End If End If Dtemp1 = 0 numeros = numeros + 6 'siguiente concepto a descomponer End If 'End If posicionconcepto = posicionconcepto + 1 Set CurrentCell = NextCell Wend End Sub Public Sub informe_jprecios(ByVal Lii As Integer, ByVal Liii As Integer, ByVal filtro As String) Dim Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto Dim i As Double, j As Double Dim numeros As Double Dim Dnumeros As Double Dim Ilocaliza As Integer Dim Bpasa As Boolean Dim Drend As Double 'EL RENDIMIENTO Dim Deditarimporte As Double Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Deditartotalimporte As Double ar As String br As String Dtemp1 As Double DK As Double 'coef de revision Bcuidado As Boolean Scadena2 As String NextCell As Range CurrentCell As Range RightCell As Range LeftCell As Range

Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Bcuidado = False numeros = 5 'numero de inicio de presentacion de lnea Dnumeros = 1 DK = 0.778160164 ' = 0.99015164 x 0,78589999 Set CurrentCell = NextCell Hoja5.Activate Columns("E:E").ColumnWidth = 30 Scadena2 = ""

Mdulo9 - 9 While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) ar = Hoja4.Cells(posicionconcepto, 1) 'codigo If filtro = "*" And Hoja4.Cells(posicionconcepto, 4) = "P" Then Bpasa = True ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", filtro) = 2 Then br = Strings.Right(filtro, Len(filtro) - 1) ' mon* br = Strings.Left(filtro, Len(filtro) - 1) ' mon If InStr(1, br, ar) <> 0 Then Bpasa = True End If en

ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Left(filtro, 1)) = 1 Th

hen

br = Strings.Right(filtro, Len(filtro) - 1) 'hola If br = Strings.Right(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Right(filtro, 1)) = 1 T br = Strings.Left(filtro, Len(filtro) - 1) 'hola If br = Strings.Left(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And ar = filtro Then Bpasa = True Else Bpasa = False End If If Bpasa Then Bpasa = False Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Set RightCell = Cells(numeros, 5) Set LeftCell = Cells(numeros, 7) Range(RightCell, LeftCell).Merge Hoja5.Cells(numeros, 1) = "P" 'Descriptor Hoja5.Cells(numeros, 2) = Hoja4.Cells(posicionconcepto, 1) Hoja5.Cells(numeros, 2).Font.Bold = True Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 2) Hoja5.Cells(numeros, 4).Font.Bold = True Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 3) Hoja5.Cells(numeros, 5).Font.Bold = True Hoja5.Cells(numeros, 5).WrapText = True Rows(numeros).EntireRow.AutoFit If B_Solo_texto_resumido = False Then numeros = numeros + 1 Set RightCell = Cells(numeros, 5) Set LeftCell = Cells(numeros, 7) Range(RightCell, LeftCell).Merge Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 1) = "tl" Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto,

'codigo 'unidad 'resumen

6)

End If Bdescomposicion = False Deditartotalimporte = 0 Scadena2 = "=" Drend = 0 i = 0 numeros = numeros + 2 If Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "" Then Do While Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "" If Not Bdescomposicion Then Hoja5.Cells(numeros, 1) = "tit" 'Descriptor Hoja5.Cells(numeros, 2) = "Cdigo" Hoja5.Cells(numeros, 3) = "Cantidad" Hoja5.Cells(numeros, 4) = "UM" Hoja5.Cells(numeros, 5) = "Descripcin" Hoja5.Cells(numeros, 6) = "Precio" Hoja5.Cells(numeros, 7) = "Importe" Set RightCell = Cells(numeros, 2)

Mdulo9 - 10 Set LeftCell = Cells(numeros, 7) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle Range(RightCell, LeftCell).Font.Bold = True numeros = numeros + 1

imiento

End If If Hoja4.Cells(posicionconcepto, 100 + i * 4) <> "nuevalinea" Then 'primero el rendimiento If Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1) <> "" Then Drend = CDbl(Hoja4.Cells(posicionconcepto, 100 + i * 4 + 1)) ' aqui el rend Else

Drend = 0 Deditarimporte = 0

End If For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(posicionconcepto, 100 + i * 4)) Then Exit For End If Next j

tras

If Hoja4.Cells(j + ipuntero + 1, 4) = "%" Then Deditarimporte = Round(Deditartotalimporte * Drend, Lii) Deditartotalimporte = Deditartotalimporte + Deditarimporte Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Hoja5.Cells(numeros, 5).VerticalAlignment = xlTop Hoja5.Cells(numeros, 6).VerticalAlignment = xlTop Hoja5.Cells(numeros, 7).VerticalAlignment = xlTop Hoja5.Cells(numeros, 1) = "Des" 'Descriptor Hoja5.Cells(numeros, 2) = "%CI" 'codigo Hoja5.Cells(numeros, 5) = "Costes Indirectos" ' texto resumen maximo 50 le

ros))

Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros, 7) = Deditarimporte Hoja5.Cells(numeros, 6).NumberFormat = format(Lii) 'PRECIO Hoja5.Cells(numeros, 6) = Drend * 100 Scadena2 = Strings.Trim(Scadena2) + "+G" & Strings.Trim(Conversion.Str(nume ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "mat" Then Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5))

maximo 50 letras

Bdescomposicion = True ' para determinar que se pone al final Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Hoja5.Cells(numeros, 5).VerticalAlignment = xlTop Hoja5.Cells(numeros, 6).VerticalAlignment = xlTop Hoja5.Cells(numeros, 7).VerticalAlignment = xlTop Hoja5.Cells(numeros, 1) = "Des" 'Descriptor Hoja5.Cells(numeros, 2) = Hoja4.Cells(j + ipuntero + 1, 1) 'codigo Hoja5.Cells(numeros, 5) = Hoja4.Cells(j + ipuntero + 1, 3) ' texto resumen Hoja5.Cells(numeros, 4) = Hoja4.Cells(j + ipuntero + 1, 2) 'UNIDAD

ros))

Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros, 6).NumberFormat = format(Lii) 'PRECIO Hoja5.Cells(numeros, 6) = Deditarimporte Hoja5.Cells(numeros, 3).NumberFormat = format(Liii) 'RENDIMIENTO Hoja5.Cells(numeros, 3) = Drend Deditarimporte = Round(Deditarimporte * Drend, Lii) Hoja5.Cells(numeros, 7) = Deditarimporte Deditartotalimporte = Deditartotalimporte + Deditarimporte Scadena2 = Strings.Trim(Scadena2) + "+G" & Strings.Trim(Conversion.Str(nume Hoja5.Cells(numeros, 5).WrapText = True Rows(numeros).EntireRow.AutoFit numeros = numeros + 1

Mdulo9 - 11 ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "&&" Then 'REDONDEO Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) Deditarimporte = Round(Deditarimporte * Drend, Lii) Deditartotalimporte = Deditartotalimporte + Deditarimporte ElseIf Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then 'CAPITULOS 'EN CAPITULOS; NO HACEMOS NADA Else 'mo, maq, PARTIDAS, otros Deditarimporte = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Hoja5.Cells(numeros, 5).VerticalAlignment = xlTop Hoja5.Cells(numeros, 6).VerticalAlignment = xlTop Hoja5.Cells(numeros, 7).VerticalAlignment = xlTop Bdescomposicion = True Hoja5.Cells(numeros, 1) = "Des" 'Descriptor Hoja5.Cells(numeros, 2) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(numeros, 5) = Hoja4.Cells(j + ipuntero + 1, 3) Hoja5.Cells(numeros, 4) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(numeros, Hoja5.Cells(numeros, Hoja5.Cells(numeros, Hoja5.Cells(numeros,

maximo 50 letras

'codigo ' texto resumen 'UNIDAD

6).NumberFormat = format(Lii) 'PRECIO 6) = Deditarimporte 3).NumberFormat = format(Liii) 'RENDIMIENTO 3) = Drend

Deditarimporte = Round(Deditarimporte * Drend, Lii) Hoja5.Cells(numeros, 7) = Deditarimporte

ros))

Deditartotalimporte = Deditartotalimporte + Deditarimporte Hoja5.Cells(numeros, 5).WrapText = True Rows(numeros).EntireRow.AutoFit Scadena2 = Strings.Trim(Scadena2) + "+G" & Strings.Trim(Conversion.Str(nume numeros = numeros + 1 End If i = i + 1 Else Deditarimporte = 0

Loop Else ' no tiene descomposicin

' Aqui no hay descompuesto End If

End If If Bdescomposicion Then 'OTROS CONCEPTOS Hoja5.Cells(numeros + 2, 1) = "t" 'Descriptor Hoja5.Cells(numeros + 2, 6) = "TOTAL" Hoja5.Cells(numeros + 2, 6).Font.Bold = True Hoja5.Cells(numeros + 2, 7).NumberFormat = format(Lii) If Scadena2 = "=" Then Hoja5.Cells(numeros + 2, 7) = CDbl(0) Else Hoja5.Cells(numeros + 2, 7).FormulaLocal = Scadena2 End If Hoja5.Cells(numeros + 2, 7).Font.Bold = True Hoja5.Cells(numeros + 2, 7).Borders(xlEdgeTop).LineStyle = xlContinuous Else 'SIN DESCOMPOSICION Hoja5.Cells(numeros, 1) = "Des" Hoja5.Cells(numeros, 6) = "SIN DESCOMPOSICION" Hoja5.Cells(numeros + 2, 1) = "t" Hoja5.Cells(numeros, 6).Font.Bold = True Hoja5.Cells(numeros + 2, 6) = "TOTAL" Hoja5.Cells(numeros + 2, 7).NumberFormat = format(Lii) Hoja5.Cells(numeros + 2, 7).Font.Bold = True

Mdulo9 - 12 Hoja5.Cells(numeros + 2, 7) = Hoja4.Cells(posicionconcepto, 5) Hoja5.Cells(numeros + 2, 7).Borders(xlEdgeTop).LineStyle = xlContinuous End If numeros = numeros + 4 'siguiente concepto a descomponer End If posicionconcepto = posicionconcepto + 1 Set CurrentCell = NextCell Wend End Sub Public Sub med_sys(ByVal Lii As Integer) Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4 As Double Dim imarca1, imarca2, imarca3 As Double Dim iindice1, iindice2, iindice3, iindice4 As Integer Dim TBase2, TBase3, TBase4 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2 As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2 As Double Dim Bok, Bok1, Bok2 As Double Dim ipuntero1, ipuntero2, ipuntero3 As Integer Dim Dtemp_m, Dtemp_p As Double Dim coefprod As Double Dim RightCell As Range Dim LeftCell As Range Dim NextCell As Range Dim CurrentCell As Range Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 'D_Proy = 0 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If

Iajusta = 0 ipoint = 5 i1 = 1 + D_Proy iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Bnoentro = True Bnoentro1 = True Bnoentro2 = True

Mdulo9 - 13

Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("D:H").ColumnWidth = 4 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Bnoentro2 = False

Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) ) Then ipuntero1 = j Exit For End If Next j If Iajusta < 1 Then Iajusta = 1 IFlagposition1 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 4).Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero Hoja5.Cells(ipoint, 4) = Hoja4.Cells(j + ipuntero Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Bok2 = True Bnoentro2 = True ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 3).Font.Bold = True 4).Font.Bold = True 5).Font.Bold = True 5) = Hoja4.Cells(j + ipuntero 3) = Hoja4.Cells(j + ipuntero 4) = Hoja4.Cells(j + ipuntero 2) = Strings.format((iindice1 + 1 5).Font.Bold = True 2).Font.Underline = 2).Font.Underline = 3).Font.Underline = 5).Font.Underline = 1) = "c"

+ + + +

1, 3) ' el resumen 1, 1) 1, 2) 1), "00")

xlUnderlineStyleSingle xlUnderlineStyleSingle xlUnderlineStyleSingle xlUnderlineStyleSingle

Else

+ + + +

1, 3) ' el resumen 1, 1) 1, 2) 1), "00")

Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 8) Range(RightCell, LeftCell).Merge Range(RightCell, LeftCell).WrapText = True Range(RightCell, LeftCell).HorizontalAlignment = xlJustify Rows(ipoint).EntireRow.AutoFit Hoja5.Cells(ipoint, 1) = "p"

Mdulo9 - 14 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 3).VerticalAlignment = xlTop 4).VerticalAlignment = xlTop 5).VerticalAlignment = xlTop 4).Font.Bold = True 4).NumberFormat = format(Lii) 4) = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1))

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 Hoja5.Cells(ipoint, 3) = "Descripcin" Hoja5.Cells(ipoint, 4) = "Unidades" Hoja5.Cells(ipoint, 6) = "Largo" Hoja5.Cells(ipoint, 7) = "Ancho" Hoja5.Cells(ipoint, 8) = "Alto" Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Hoja5.Cells(ipoint, 9) = "Parcial" Set RightCell = Cells(ipoint, 3) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle Rows(ipoint).EntireRow.AutoFit ipoint = ipoint + 2 Hoja5.Cells(ipoint, 4).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Hoja5.Cells(ipoint, 4).NumberFormat = format(Lii) ipoint = ipoint + 2 Hoja5.Cells(ipoint, 7) = "Total ..." Hoja5.Cells(ipoint, 9).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 9).Borders(xlEdgeBottom).LineStyle = xlContinuous Hoja5.Cells(ipoint, 9).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Hoja5.Cells(ipoint, 9) = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) ipoint = ipoint + 2 End If Bok2 = False End If TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy

Bnoentro1 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(i2, 2)) Then ipuntero2 = j Exit For End If Next j Bmarcasalto2 = True Bok2 = False

ulo

If Iajusta < 2 Then Iajusta = 2 IFlagposition2 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subcapit Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1)

Mdulo9 - 15

e2 + 1, "00")

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 6).Select Bok1 = True Bnoentro1 = True ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

Else

apitulo

3).Font.Bold = True 5).Font.Bold = True 6).Font.Bold = True 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subc

ndice2 + 1, "00")

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(ii

1)) 'medicion real

iindice2 = iindice2 + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Merge Range(RightCell, LeftCell).WrapText = True Range(RightCell, LeftCell).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 3).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 4).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 5).VerticalAlignment = xlTop 'Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 +

)) 'medicion real

Hoja5.Cells(ipoint, 4).Font.Bold = True Hoja5.Cells(ipoint, 4).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1

))

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 Hoja5.Cells(ipoint, 3) = "Descripcin" Hoja5.Cells(ipoint, 4) = "Unidades" Hoja5.Cells(ipoint, 6) = "Largo" Hoja5.Cells(ipoint, 7) = "Ancho" Hoja5.Cells(ipoint, 8) = "Alto" Hoja5.Cells(ipoint, 9) = "Parcial" Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Set RightCell = Cells(ipoint, 3) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle ipoint = ipoint + 2 Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1 ipoint = ipoint + 2 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

))

7) = "Total ..." 9).Borders(xlEdgeTop).LineStyle = xlContinuous 9).Borders(xlEdgeBottom).LineStyle = xlContinuous 9).NumberFormat = format(Lii) 9).HorizontalAlignment = xlRight 9) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1

Mdulo9 - 16 ipoint = ipoint + 2 End If Bok1 = False End If

)) Then

TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Bnoentro = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0

Cells(i3, 2)) Then

imarca3 = imarca3 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. ipuntero3 = j Exit For End If Next j Bmarcasalto1 = True Bok1 = False If Iajusta < 3 Then Iajusta = 3 IFlagposition3 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 7).Font.Bold = True

subcapitulo

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "ssc" Bok = True Bnoentro = True ipoint = ipoint + 2 Else Dtemp_m = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 7).Font.Bold = True men subcapitulo

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resu

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Set RightCell = Cells(ipoint, 7) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Range(RightCell, LeftCell).WrapText = True Range(RightCell, LeftCell).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 3).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 4).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 5).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 4).Font.Bold = True Hoja5.Cells(ipoint, 4).NumberFormat = format(Lii)

Mdulo9 - 17 * 3 + 1))

Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto

* 3 + 1))

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 Hoja5.Cells(ipoint, 3) = "Descripcin" Hoja5.Cells(ipoint, 4) = "Unidades" Hoja5.Cells(ipoint, 6) = "Largo" Hoja5.Cells(ipoint, 7) = "Ancho" Hoja5.Cells(ipoint, 8) = "Alto" Hoja5.Cells(ipoint, 9) = "Parcial" Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Set RightCell = Cells(ipoint, 3) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle ipoint = ipoint + 2 Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto

us

ipoint = ipoint + 2 Hoja5.Cells(ipoint, 7) = "Total ..." Hoja5.Cells(ipoint, 9).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 9).Borders(xlEdgeBottom).LineStyle = xlContinuo

* 3 + 1))

Hoja5.Cells(ipoint, 9).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Hoja5.Cells(ipoint, 9) = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto ipoint = ipoint + 2 End If Bok = False End If

se4) > 0)) Then

TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy iindice4 = 1 'Scadena4 = "=" Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

m(Hoja4.Cells(i4, 2)) Then

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Tri Exit For End If Next j Bmarcasalto = True Bok = False If Iajusta < 4 Then Iajusta = 4 IFlagposition4 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 7).Font.Bold = True Hoja5.Cells(ipoint, 8) = Hoja4.Cells(j + ipuntero + 1, 3) ' el

resumen subcapitulo

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strin gs.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 8).Select Hoja5.Cells(ipoint, 1) = "sssc"

Mdulo9 - 18 Else ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & S trings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") iindice4 = iindice4 + 1 Set RightCell = Cells(ipoint, 8) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Range(RightCell, LeftCell).WrapText = True Range(RightCell, LeftCell).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 3).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 4).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 5).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).Font.Bold = True Hoja5.Cells(ipoint, 4).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_ proyecto * 3 + 1)) ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 Hoja5.Cells(ipoint, 3) = "Descripcin" Hoja5.Cells(ipoint, 4) = "Unidades" Hoja5.Cells(ipoint, 6) = "Largo" Hoja5.Cells(ipoint, 7) = "Ancho" Hoja5.Cells(ipoint, 8) = "Alto" Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Hoja5.Cells(ipoint, 9) = "Parcial" Set RightCell = Cells(ipoint, 3) Set LeftCell = Cells(ipoint, 9) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyl eSingle ipoint = ipoint + 2 Hoja5.Cells(ipoint, 4) = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_ proyecto * 3 + 1)) ipoint = ipoint + 2 Hoja5.Cells(ipoint, 7) = "Total ..." Hoja5.Cells(ipoint, 9).Borders(xlEdgeTop).LineStyle = xlCon tinuous Hoja5.Cells(ipoint, 9).Borders(xlEdgeBottom).LineStyle = xl Continuous Hoja5.Cells(ipoint, 9).HorizontalAlignment = xlRight Hoja5.Cells(ipoint, 9).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 9) = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_ proyecto * 3 + 1)) ipoint = ipoint + 2 End If End If

el resumen subcapitulo

3).Font.Bold = True 8).Font.Bold = True 7).Font.Bold = True 8) = Hoja4.Cells(j + ipuntero + 1, 3) '

Mdulo9 - 19 End If i4 = i4 + 1

Loop

End If If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True Bok = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro = False

Loop

End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True ipoint = ipoint + 2 ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False ipoint = ipoint + 2 End If Bnoentro1 = False i2 = i2 + 1 Loop End If If Bmarcasalto2 = True Then Bmarcasalto2 = False Bnoentro2 = True Bok2 = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro2 = False

Loop

End Sub Public Sub presenta_cp1(ByVal Lii As Integer, ByVal Btrabajaparpres As Boolean, ByVal filtro As Str ing) 'Btrabajaparpres indica si hay que presentar las partidas que estan en el presupuesto 'Lii es el numero de decimales de trabajo 'Btrabajaparpres = FALSE=todos sirve para presentar partidas que no esten en el presupuesto 'filtro es filtro de concepto para presentar en el informe Dim i As Double Dim numeros As Double Dim Dnumeros As Double Dim Ilocaliza As Integer Dim DK As Double 'coef de revision Dim Rkey As Range

Mdulo9 - 20 Dim Dim Dim Dim Dim Dim Dim Dim NextCell As Range CurrentCell As Range Deditarimporte As Double Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto ar As String br As String Bpasa As Boolean 'los que tengan precios Bpasa_cod As Boolean 'los que tengan el codigo filtrado

Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 numeros = 5 'numero de inicio de presentacion de lnea Dnumeros = 1 DK = 1 Set CurrentCell = NextCell Hoja5.Activate Columns("A:A").ColumnWidth Columns("D:D").ColumnWidth Columns("E:E").ColumnWidth Columns("F:F").ColumnWidth Hoja5.Cells(numeros, 1) Hoja5.Cells(numeros, 2) Hoja5.Cells(numeros, 3) Hoja5.Cells(numeros, 4) Hoja5.Cells(numeros, 5) Hoja5.Cells(numeros, 6) Hoja5.Cells(numeros, 7) numeros = numeros + 1 = = = = = = = = = = = 3 4 20 'ANCHO PARTIDA Y PRECIO EN LETRA 20

"tit" 'Descriptor "N" "Cdigo" "UM" "Descripcin" "Importe en letras" "Importe en cifras"

While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) If Not Btrabajaparpres Then 'presentar todos los conceptos Bpasa = True Else 'presentar todos los conceptos que esten en el presupuesto Bpasa = False For i = D_Proy + 1 To D_Proy + 1 + Ipuntos If Hoja4.Cells(posicionconcepto, 1) = Hoja4.Cells(i, 2) Then Bpasa = True Exit For End If Next i End If ar = Hoja4.Cells(posicionconcepto, 1) 'codigo If filtro = "*" And Hoja4.Cells(posicionconcepto, 4) = "P" Then Bpasa_cod = True ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", filtro) = 2 Then

Mdulo9 - 21 br = Strings.Right(filtro, Len(filtro) - 1) ' mon* br = Strings.Left(filtro, Len(filtro) - 1) ' mon If InStr(1, br, ar) <> 0 Then Bpasa_cod = True End If en

ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Left(filtro, 1)) = 1 Th

hen

br = Strings.Right(filtro, Len(filtro) - 1) 'hola If br = Strings.Right(ar, Len(br)) Then Bpasa_cod = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Right(filtro, 1)) = 1 T br = Strings.Left(filtro, Len(filtro) - 1) 'hola If br = Strings.Left(ar, Len(br)) Then Bpasa_cod = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And ar = filtro Then Bpasa_cod = True Else Bpasa_cod = False End If If Hoja4.Cells(posicionconcepto, 4) = "P" And Bpasa And Bpasa_cod Then Hoja5.Cells(numeros, 2) = Strings.Trim(Dnumeros) Dnumeros = Dnumeros + 1 Hoja5.Cells(numeros, 1).VerticalAlignment = xlTop Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Hoja5.Cells(numeros, 7).VerticalAlignment = xlTop Hoja5.Cells(numeros, 1) = "c" 'descriptor Hoja5.Cells(numeros, 3) = Hoja4.Cells(posicionconcepto, 1) 'codigo Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 2) 'unidad Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 5).HorizontalAlignment = xlJustify Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 3) Hoja5.Cells(numeros, 7).NumberFormat = format(Lii) Deditarimporte = CDbl(Hoja4.Cells(posicionconcepto, 5)) Deditarimporte = Round(Deditarimporte, Lii) Hoja5.Cells(numeros, 7) = Deditarimporte Rows(numeros).EntireRow.AutoFit 'resumen

en letra

Hoja5.Cells(numeros, 6) = NumLetra(Deditarimporte, 2, "euros", "cntimos", "con") Hoja5.Cells(numeros, 6).WrapText = True Rows(numeros).EntireRow.AutoFit If B_Solo_texto_resumido = False Then numeros = numeros + 1 Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 1) = "tl" Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 6) End If numeros = numeros + 2

'precio

End If posicionconcepto = posicionconcepto + 1 Set CurrentCell = NextCell Wend

End Sub Public Sub presenta_todos(ByVal Lii As Integer, ByVal Btrabajaparpres As Boolean, ByVal filtro As S tring) 'Btrabajaparpres indica si hay que presentar las partidas que estan en el presupuesto

Mdulo9 - 22 'Lii es el numero de decimales de trabajo 'Btrabajaparpres = FALSE=todos sirve para presentar partidas que no esten en el presupuesto 'filtro es filtro de concepto para presentar en el informe Dim i, j As Double Dim numeros As Double Dim Dnumeros As Double Dim Ilocaliza As Integer Dim DK As Double 'coef de revision Dim Dim Dim Dim Dim Dim Dim Dim Dim Rkey As Range NextCell As Range CurrentCell As Range Deditarimporte As Double Bdescomposicion As Boolean 'se encarga de indicar que hay descompuesto ar As String br As String Bpasa As Boolean 'los que tengan precios Bpasa_cod As Boolean 'los que tengan el codigo filtrado

Dim format(0 To 4) As String format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Hoja4.Activate Set Rkey = Hoja4.Cells(D_Proy + 1, 1) Rkey.Select If IsEmpty(Rkey.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 numeros = 5 'numero de inicio de presentacion de lnea Dnumeros = 1 DK = 1 Set CurrentCell = NextCell Hoja5.Activate Columns("A:A").ColumnWidth Columns("B:B").ColumnWidth Columns("D:D").ColumnWidth Columns("E:E").ColumnWidth Columns("F:F").ColumnWidth Hoja5.Cells(numeros, 1) Hoja5.Cells(numeros, 2) Hoja5.Cells(numeros, 3) Hoja5.Cells(numeros, 4) Hoja5.Cells(numeros, 5) Hoja5.Cells(numeros, 6) numeros = numeros + 1 = = = = = = = = = = = 3 6 4 80 'ANCHO PARTIDA Y PRECIO EN LETRA 20

"tit" 'Descriptor "N" "Cdigo" "UM" "Descripcin" "Importe en cifras"

While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) If Not Btrabajaparpres Then 'presentar todos los conceptos Bpasa = True Else 'presentar todos los conceptos que esten en el presupuesto Bpasa = False

Mdulo9 - 23 For i = D_Proy + 1 To D_Proy + 1 + Ipuntos If Hoja4.Cells(posicionconcepto, 1) = Hoja4.Cells(i, 2) Then Bpasa = True Exit For End If Next i

'**** For i = 1 To IConceptos j = 0 Do While Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) <> "" If Hoja4.Cells(i + ipuntero + 1, 100 + j * 4) = Strings.Trim(Hoja4.Cells(posicionco ncepto, 1)) Then 'EL CODIGO ESTA DENTRO DE UN DESCOMPUESTO DE PARTIDA 'MsgBox "No se puede borrar un concepto que esta de auxiliar de partida!!!" Bpasa = True Exit For End If j = j + 1 Loop Next End If ar = Hoja4.Cells(posicionconcepto, 1) 'codigo If filtro = "*" Then Bpasa_cod = True ElseIf InStr(1, "*", filtro) = 2 Then br = Strings.Right(filtro, Len(filtro) - 1) ' mon* br = Strings.Left(filtro, Len(filtro) - 1) ' mon If InStr(1, br, ar) <> 0 Then Bpasa_cod = True End If ElseIf InStr(1, "*", Strings.Left(filtro, 1)) = 1 Then br = Strings.Right(filtro, Len(filtro) - 1) 'hola If br = Strings.Right(ar, Len(br)) Then Bpasa_cod = True End If ElseIf InStr(1, "*", Strings.Right(filtro, 1)) = 1 Then br = Strings.Left(filtro, Len(filtro) - 1) 'hola If br = Strings.Left(ar, Len(br)) Then Bpasa_cod = True End If ElseIf ar = filtro Then Bpasa_cod = True Else Bpasa_cod = False End If If Bpasa And Bpasa_cod Then Hoja5.Cells(numeros, 2) = Strings.Trim(Dnumeros) Dnumeros = Dnumeros + 1 'numero de partida descompuesta Hoja5.Cells(numeros, 1).VerticalAlignment = xlTop Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 4).VerticalAlignment = xlTop Hoja5.Cells(numeros, 7).VerticalAlignment = xlTop Hoja5.Cells(numeros, 1) = Hoja4.Cells(posicionconcepto, 4) 'descriptor Hoja5.Cells(numeros, 3) = Hoja4.Cells(posicionconcepto, 1) 'codigo Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 2) 'unidad Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 5).HorizontalAlignment = xlJustify Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 3) Hoja5.Cells(numeros, 6).NumberFormat = format(Lii) Deditarimporte = CDbl(Hoja4.Cells(posicionconcepto, 5)) Deditarimporte = Round(Deditarimporte, Lii) 'resumen

Mdulo9 - 24 Hoja5.Cells(numeros, 6) = Deditarimporte Rows(numeros).EntireRow.AutoFit Rows(numeros).EntireRow.AutoFit If B_Solo_texto_resumido = False Then numeros = numeros + 1 Hoja5.Cells(numeros, 5).WrapText = True Hoja5.Cells(numeros, 1) = "tl" Hoja5.Cells(numeros, 5) = Hoja4.Cells(posicionconcepto, 6) End If numeros = numeros + 1 'siguiente concepto a descomponer End If posicionconcepto = posicionconcepto + 1 Set CurrentCell = NextCell Wend End Sub Public Sub pres_presupuesto_sys() Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5 As Double Dim imarca1, imarca2, imarca3, imarca4 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5 As Integer Dim TBase2, TBase3, TBase4, TBase5 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2 As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2 As Double Dim Bok, Bok1, Bok2 As Double Dim ipuntero1, ipuntero2, ipuntero3 As Integer Dim Scadena1, Scadena2, Scadena3, Scadena4 As String Dim coefprod As Double Dim Dtemp_m, Dtemp_p As Double Dim NextCell As Range Dim CurrentCell As Range Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 'D_Proy = 0 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If

Iajusta = 0 ipoint = 5 i1 = 1 + D_Proy iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 = "=" Scadena2 = "=" Scadena3 = "="

Mdulo9 - 25 Scadena4 = "=" Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("D:H").ColumnWidth = 4 Columns("F:F").ColumnWidth = 25 Bnoentro2 = False

Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) ) Then ipuntero1 = j Exit For End If Next j If Iajusta < 1 Then Iajusta = 1 'IFlagposition1 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Bok2 = True Bnoentro2 = True ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 4).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 5) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen 3) = Hoja4.Cells(j + ipuntero + 1, 1) 2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 4).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 5) = Hoja4.Cells(j + ipuntero 3) = Hoja4.Cells(j + ipuntero 4) = Hoja4.Cells(j + ipuntero 2) = Strings.format((iindice1 + 1

+ + + +

1, 3) ' el resumen 1, 1) 1, 2) 1), "00")

5).Font.Bold = True 3).Font.Bold = True 2).Font.Bold = True 1) = "c" 2).Font.Underline = xlUnderlineStyleSingle 3).Font.Underline = xlUnderlineStyleSingle 5).Font.Underline = xlUnderlineStyleSingle

Else

Mdulo9 - 26 Hoja5.Cells(ipoint, 4) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1

cion presupuesto

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 5).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 5).WrapText = True Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) 'importe de ejecu

Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Rows(ipoint).EntireRow.AutoFit ipoint = ipoint + 2 End If Bok2 = False End If

TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Scadena2 = "=" Bnoentro1 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(i2, 2)) Then ipuntero2 = j Exit For End If Next j Bmarcasalto2 = True Bok2 = False If Iajusta < 2 Then Iajusta = 2 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

ulo

2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 5).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subcapit

e2 + 1, "00")

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Bok1 = True Bnoentro1 = True ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then 1) = "sc" 6).Font.Bold = True 3).Font.Bold = True 2).Font.Bold = True 2).Font.Underline = xlUnderlineStyleSingle 3).Font.Underline = xlUnderlineStyleSingle 6).Font.Underline = xlUnderlineStyleSingle

Else

Mdulo9 - 27 Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

apitulo

2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 5).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subc

ndice2 + 1, "00")

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(ii iindice2 = iindice2 + 1

nt))

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 6).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 6).WrapText = True Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoi

Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) ' * coefpr od 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) 'medicion real Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(i point)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Rows(ipoint).EntireRow.AutoFit ipoint = ipoint + 2 End If Bok1 = False End If

)) Then

TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Scadena3 = "=" Bnoentro = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0

Cells(i3, 2)) Then

imarca3 = imarca3 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. ipuntero3 = j Exit For End If Next j Bmarcasalto1 = True Bok1 = False If Iajusta < 3 Then Iajusta = 3 'IFlagposition3 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 6).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop

subcapitulo

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 7).Font.Bold = True Hoja5.Cells(ipoint, 3).Font.Bold = True Hoja5.Cells(ipoint, 2).Font.Bold = True

Mdulo9 - 28 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Bok = True Bnoentro = True ipoint = ipoint + 2 Dtemp_m = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 6).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 2).Font.Underline = xlUnderlineStyleSingle 3).Font.Underline = xlUnderlineStyleSingle 7).Font.Underline = xlUnderlineStyleSingle 1) = "ssc"

Else

men subcapitulo

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resu

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1

Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 7).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 7).WrapText = True Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.

Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) ' * coefprod 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyect o * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversi on.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Rows(ipoint).EntireRow.AutoFit ipoint = ipoint + 2 End If Bok = False End If

se4) > 0)) Then

TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy iindice4 = 1 Scadena4 = "=" Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

m(Hoja4.Cells(i4, 2)) Then

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Tri Exit For End If Next j Bmarcasalto = True Bok = False If Iajusta < 4 Then Iajusta = 4 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 7).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop

Mdulo9 - 29 resumen subcapitulo Hoja5.Cells(ipoint, 8) = Hoja4.Cells(j + ipuntero + 1, 3) ' el = = = &

Hoja5.Cells(ipoint, 3) Hoja5.Cells(ipoint, 7) Hoja5.Cells(ipoint, 2) gs.format(iindice2, "00") & Strings.format(iindice3, "00") iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 2 Else

Hoja4.Cells(j + ipuntero + 1, 1) Hoja4.Cells(j + ipuntero + 1, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

8).Font.Bold = True 3).Font.Bold = True 2).Font.Bold = True 2).Font.Underline = xlUnderlineStyleSingle 3).Font.Underline = xlUnderlineStyleSingle 8).Font.Underline = xlUnderlineStyleSingle 1) = "sssc"

Dtemp_m = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1)) Dtemp_p = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) If (B_Pres_Solo_Con_Medicion And Dtemp_m = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Dtemp_p = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

Hoja5.Cells(ipoint, 3) Hoja5.Cells(ipoint, 7) Hoja5.Cells(ipoint, 2) trings.format(iindice2, "00") & Strings.format(iindice3, "00") iindice4 = iindice4 + 1

el resumen subcapitulo

2).VerticalAlignment = xlTop 3).VerticalAlignment = xlTop 7).VerticalAlignment = xlTop 11).VerticalAlignment = xlTop 12).VerticalAlignment = xlTop 13).VerticalAlignment = xlTop 8) = Hoja4.Cells(j + ipuntero + 1, 3) ' = = = &

Hoja4.Cells(j + ipuntero + 1, 1) Hoja4.Cells(j + ipuntero + 1, 2) Strings.format(iindice1, "00") & S Strings.format(iindice4 + 1, "00")

version.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 8).HorizontalAlignment = xlJustify Hoja5.Cells(ipoint, 8).WrapText = True Scadena4 = Strings.Trim(Scadena4) + "+M" & Strings.Trim(Con

Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1 , 5)) ' * coefprod 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i4, 7 + Itipo_de _proyecto * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim( Conversion.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Rows(ipoint).EntireRow.AutoFit ipoint = ipoint + 2 End If End If End If i4 = i4 + 1

Loop

nt)) )

End If If Bmarcasalto = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Bmarcasalto = False Bnoentro = True Bok = True Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.Str(ipoi

Hoja5.Cells(ipoint, 7) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3 Hoja5.Cells(ipoint, 7).Select

Mdulo9 - 30 If Scadena4 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena4 End If Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous

Bnoentro = False Hoja5.Cells(ipoint, 7) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro = False

Loop

End If If Bmarcasalto1 = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Bmarcasalto1 = False Bnoentro1 = True Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 6) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 6).Select If Scadena3 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena3 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok1 = True And Bnoentro1 = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Bnoentro1 = False Hoja5.Cells(ipoint, 6) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 6).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If Bnoentro1 = False i2 = i2 + 1 Loop End If If Bmarcasalto2 = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous

Mdulo9 - 31 Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Bmarcasalto2 = False Bnoentro2 = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select If Scadena2 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena2 End If Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro2 = False

Loop Hoja5.Cells(ipoint, 13).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 13).Borders(xlEdgeBottom).LineStyle = xlContinuous Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 5) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena1 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With 'Hoja4.Activate End Sub

Public Sub informe_actaprecios(ByVal Lii As Integer, ByVal Liii As Integer, ByVal filtro As String) 'Lii es el numero de decimales de trabajo Dim i As Double, j As Double Dim numeros As Double Dim Dnumeros As Double Dim Ilocaliza As Integer Dim Bpasa As Boolean Dim Dim Dim Dim Dim ar As String br As String Dtemp1 As Double DK As Double 'coef de revision Bcuidado As Boolean

Dim NextCell As Range

Mdulo9 - 32 Dim CurrentCell As Range Dim RightCell As Range Dim LeftCell As Range

Dim format(0 To 4) As String format(0) = "#,###,###,###,##0" format(1) = "#,###,###,###,##0.0" format(2) = "#,###,###,###,##0.00" format(3) = "#,###,###,###,##0.000" format(4) = "#,###,###,###,##0.0000" Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Bcuidado = False numeros = 5 'numero de inicio de presentacion de lnea Dnumeros = 1 DK = 1 Set CurrentCell = NextCell Hoja5.Activate Columns("D:D").ColumnWidth = 22 Columns("E:E").ColumnWidth = 22 Hoja5.Cells(numeros, 2) = "Cdigo" Hoja5.Cells(numeros, 3) = "UM" Hoja5.Cells(numeros, 4) = "Descripcin" Hoja5.Cells(numeros, 5) = "Importe en letras" Hoja5.Cells(numeros, 6) = "Importe en cifras" Set RightCell = Cells(numeros, 2) Set LeftCell = Cells(numeros, 6) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle Range(RightCell, LeftCell).Font.Bold = True numeros = numeros + 1 While (Not IsEmpty(CurrentCell)) Set NextCell = CurrentCell.Offset(1, 0) ar = Hoja4.Cells(posicionconcepto, 1) 'codigo If filtro = "*" And Hoja4.Cells(posicionconcepto, 4) = "P" Then Bpasa = True ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", filtro) = 2 Then br = Strings.Right(filtro, Len(filtro) - 1) br = Strings.Left(filtro, Len(filtro) - 1) If InStr(1, br, ar) <> 0 Then Bpasa = True End If en

ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Left(filtro, 1)) = 1 Th

hen

br = Strings.Right(filtro, Len(filtro) - 1) 'hola If br = Strings.Right(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And InStr(1, "*", Strings.Right(filtro, 1)) = 1 T br = Strings.Left(filtro, Len(filtro) - 1) 'hola If br = Strings.Left(ar, Len(br)) Then Bpasa = True End If ElseIf Hoja4.Cells(posicionconcepto, 4) = "P" And ar = filtro Then Bpasa = True Else Bpasa = False End If If Bpasa Then Bpasa = False Hoja5.Cells(numeros, 2).VerticalAlignment = xlTop

Mdulo9 - 33 Hoja5.Cells(numeros, 2) = Hoja4.Cells(posicionconcepto, 1) Hoja5.Cells(numeros, 3).VerticalAlignment = xlTop Hoja5.Cells(numeros, 3) = Hoja4.Cells(posicionconcepto, 2) Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 3) Hoja5.Cells(numeros, 4).WrapText = True Rows(numeros).EntireRow.AutoFit Hoja5.Cells(numeros, 5) = " " 'codigo 'unidad 'resumen

tra

Dtemp1 = CDbl(Hoja4.Cells(posicionconcepto, 5)) Dtemp1 = Round(Dtemp1 * DK, Lii) Hoja5.Cells(numeros + 1, 5) = NumLetra(Dtemp1, 2, "euros", "cntimos", "con") 'precio en le Hoja5.Cells(numeros + 1, 5).WrapText = True Rows(numeros + 1).EntireRow.AutoFit Hoja5.Cells(numeros + 1, 6).NumberFormat = format(Lii) Hoja5.Cells(numeros + 1, 6) = Dtemp1 'precio If B_Solo_texto_resumido = False Then numeros = numeros + 1 Hoja5.Cells(numeros, 4).WrapText = True Hoja5.Cells(numeros, 1) = "tl" Hoja5.Cells(numeros, 4) = Hoja4.Cells(posicionconcepto, 6) End If numeros = numeros + 2 End If posicionconcepto = posicionconcepto + 1 Set CurrentCell = NextCell

Wend End Sub Public Sub pres_presupuesto() 'ATENCION esta desactualizado Dim i As Double, j As Double Dim ipoint As Integer Dim i1, i2, i3, i4 As Double Dim imarca1, imarca2, imarca3 As Double Dim iindice1, iindice2, iindice3, iindice4 As Integer Dim TBase2, TBase3, TBase4 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2 As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2 As Double Dim Bok, Bok1, Bok2 As Double Dim ipuntero1, ipuntero2, ipuntero3 As Integer Dim Scadena1, Scadena2, Scadena3, Scadena4 As String Dim coefprod As Double Dim NextCell As Range Dim CurrentCell As Range Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 'D_Proy = 0 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If

Mdulo9 - 34

Iajusta = 0 ipoint = 5 i1 = 1 + D_Proy iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 Scadena2 Scadena3 Scadena4 = = = = "=" "=" "=" "="

Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("D:H").ColumnWidth = 4 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft

Bnoentro2 = False 'For i = (1 + D_Proy) To (Ipuntos + D_Proy) Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) ) Then ipuntero1 = j Exit For End If Next j If Iajusta < 1 Then Iajusta = 1 IFlagposition1 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 5) = 3) = 4) = 2) = + 1 Hoja4.Cells(j + ipuntero Hoja4.Cells(j + ipuntero Hoja4.Cells(j + ipuntero Strings.format((iindice1 + + + + 1, 3) ' el resumen 1, 1) 1, 2) 1), "00")

Else

Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 1) = "c" Selection.Font.Bold = True Bok2 = True Bnoentro2 = True Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 5) = 3) = 4) = 2) = + 1 Hoja4.Cells(j + ipuntero Hoja4.Cells(j + ipuntero Hoja4.Cells(j + ipuntero Strings.format((iindice1 + + + + 1, 3) ' el resumen 1, 1) 1, 2) 1), "00")

presupuesto

Hoja5.Cells(ipoint, 1) = "p" Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) 'importe de ejecucion

Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(ipoint)) & "*

Mdulo9 - 35 L" & Strings.Trim(Conversion.Str(ipoint)) Bok2 = False

End If ipoint = ipoint + 1 TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Scadena2 = "=" Bnoentro1 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(i2, 2)) Then ipuntero2 = j Exit For End If Next j Bmarcasalto2 = True Bok2 = False If Iajusta < 2 Then Iajusta = 2 IFlagposition2 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then ulo

Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subcapit

e2 + 1, "00")

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 6).Select Selection.Font.Bold = True Bok1 = True Bnoentro1 = True

Else ulo

Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen subcapit

e2 + 1, "00")

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1

Hoja5.Cells(ipoint, 1) = "p" Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) * coefprod 'im porte de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) 'medicion real Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(ipoin t)) & "*L" & Strings.Trim(Conversion.Str(ipoint))

)) Then

Bok1 = False End If ipoint = ipoint + 1 TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Scadena3 = "=" Bnoentro = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0 imarca3 = imarca3 + 1 For j = 1 To IConceptos

Mdulo9 - 36 Cells(i3, 2)) Then

If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4. ipuntero3 = j Exit For End If Next j Bmarcasalto1 = True Bok1 = False If Iajusta < 3 Then Iajusta = 3 IFlagposition3 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then

subcapitulo

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "ssc" Selection.Font.Bold = True Bok = True Bnoentro = True Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 3) ' el resumen

Else subcapitulo

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(j + ipuntero + 1, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1

ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.Str(

Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5)) * coef prod 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.S tr(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint))

se4) > 0)) Then

Bok = False End If ipoint = ipoint + 1 TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy iindice4 = 1 Scadena4 = "=" Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

m(Hoja4.Cells(i4, 2)) Then

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Tri Exit For End If Next j Bmarcasalto = True Bok = False If Iajusta < 4 Then Iajusta = 4 IFlagposition4 = 1 If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then

resumen subcapitulo

Hoja5.Cells(ipoint, 8) = Hoja4.Cells(j + ipuntero + 1, 3) ' el Hoja5.Cells(ipoint, 3) = Hoja4.Cells(j + ipuntero + 1, 1) Hoja5.Cells(ipoint, 7) = Hoja4.Cells(j + ipuntero + 1, 2)

Mdulo9 - 37

Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strin gs.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 8).Select Hoja5.Cells(ipoint, 1) = "sssc" Selection.Font.Bold = True Hoja5.Cells(ipoint, 8) = Hoja4.Cells(j + ipuntero + 1, 3) ' el

Else resumen subcapitulo

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 7) = Hoja5.Cells(ipoint, 2) = gs.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(j + ipuntero + 1, 1) Hoja4.Cells(j + ipuntero + 1, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

ion.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena4 = Strings.Trim(Scadena4) + "+M" & Strings.Trim(Convers

Hoja5.Cells(ipoint, 11) = CDbl(Hoja4.Cells(j + ipuntero + 1, 5) ) * coefprod 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 12) = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_pro yecto * 3 + 1)) Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conv ersion.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) End If ipoint = ipoint + 1 End If i4 = i4 + 1

Loop

nt)) )

End If If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True Bok = True Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.Str(ipoi

Hoja5.Cells(ipoint, 7) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3

Hoja5.Cells(ipoint, 7).Select If Scadena4 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena4 End If Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False Hoja5.Cells(ipoint, 7) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro = False

Loop

End If

Mdulo9 - 38 If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 6) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 6).Select If Scadena3 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena3 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False Hoja5.Cells(ipoint, 6) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 6).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If Bnoentro1 = False i2 = i2 + 1 Loop End If If Bmarcasalto2 = True Then Bmarcasalto2 = False Bnoentro2 = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select If Scadena2 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena2 End If Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro2 = False

Loop

Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 5) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena1 End If

Mdulo9 - 39 Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With Hoja4.Activate End Sub

Public Sub presymed(ByVal Li As Integer, ByVal Lii As Integer, ByVal Liii As Integer, ByVal Liiii A s Integer) Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim stemp1 As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bo As Double Dim ipuntero1, ipuntero2, ipuntero3, ipuntero4, ipuntero5, ipuntero6, ipuntero7 As Integer Dim Scadena1, Scadena2, Scadena3, Scadena4, Scadena5, Scadena6, Scadena7 As String Dim coefprod As Double Dim NextCell, RightCell, LeftCell As Range Dim CurrentCell As Range Dim Deditarimporte As Double Dim Dmedicion As Double Dim format(0 To 4) As String Dim D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 'D_Proy = 0 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 = "=" Scadena2 = "=" Scadena3 = "="

Mdulo9 - 40 Scadena4 = "=" Scadena5 = "=" Scadena6 = "=" Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("D:H").ColumnWidth = 4 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 1) = "Des" 'Descriptor 2) = "numero" 3) = "Cdigo" 4) = "UM" 5) = "Resumen" 11) = "Medicion" 12) = "Precio" 13) = "Importe"

Set RightCell = Cells(ipoint, 2) Set LeftCell = Cells(ipoint, 13) Range(RightCell, LeftCell).Font.Underline = xlUnderlineStyleSingle Range(RightCell, LeftCell).Font.Bold = True ipoint = ipoint + 2 Bnoentro4 = False 'Bnoentro2 = False i1 = 1 + D_Proy Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4))

) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) D_puntero = j + ipuntero + 1 ipuntero1 = j Exit For End If Next j End If If Iajusta < 1 Then Iajusta = 1 'IFlagposition1 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 5) = 3) = 4) = 2) = + 1 Hoja4.Cells(D_puntero, 3) ' el resumen Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format((iindice1 + 1), "00")

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "c" Bok4 = True Bnoentro4 = True ipoint = ipoint + 1

Mdulo9 - 41 Else Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Dmedicion = Strings.format(Dmedicion, format(Lii)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 5) = 3) = 4) = 2) = + 1 Hoja4.Cells(D_puntero, 3) ' el resumen Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format((iindice1 + 1), "00")

Hoja5.Cells(ipoint, 1) = "p" Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 11).NumberFormat = format(Li) Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 13).NumberFormat = format(Liii) Hoja5.Cells(ipoint, 12) = Deditarimporte 'importe de ejecucion presupuesto

Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If If Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 Else ipoint = 1 + inf_med_des(ipoint, Li, Liiii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

End If ipoint = ipoint + 1 End If Bok4 = False 'Bok2 = False End If TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Scadena2 = "=" Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then

Mdulo9 - 42

s(i2, 2)) Then

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell D_puntero = j + ipuntero + 1 ipuntero2 = j Exit For End If Next j End If Bmarcasalto4 = True Bok4 = False If Iajusta < 2 Then Iajusta = 2 If Hoja4.Cells(D_puntero, 4) = "C" Then Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 5) 3) 4) 2) = = = =

e2 + 1, "00")

Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strings.format(iindic

iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 5).Font.Bold = True Bok3 = True Bnoentro3 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Dmedicion = Strings.format(Dmedicion, format(Lii)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 5) 3) 4) 2) = = = =

Else

ndice2 + 1, "00")

Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strings.format(ii

iindice2 = iindice2 + 1

nt))

Hoja5.Cells(ipoint, 1) = "p" Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoi Hoja5.Cells(ipoint, 11).NumberFormat = format(Li) Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 13).NumberFormat = format(Liii) Hoja5.Cells(ipoint, 12) = Deditarimporte 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If If Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1

Mdulo9 - 43 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Liiii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

End If ipoint = ipoint + 1 End If Bok3 = False End If

)) Then

TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Scadena3 = "=" Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0 imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4))

ja4.Cells(i3, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho D_puntero = j + ipuntero + 1 ipuntero3 = j Exit For End If Next j End If Bmarcasalto3 = True Bok3 = False If Iajusta < 3 Then Iajusta = 3 If Hoja4.Cells(D_puntero, 4) = "C" Then

tulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapi

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssc" Bok2 = True Bnoentro2 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Dmedicion = Strings.format(Dmedicion, format(Lii)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else capitulo

Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen sub

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00")

Mdulo9 - 44 iindice3 = iindice3 + 1

Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.

upuesto

Hoja5.Cells(ipoint, 11).NumberFormat = format(Li) Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 13).NumberFormat = format(Liii) Deditarimporte = Round(CDbl(Hoja4.Cells(D_puntero, 5)), Li) Hoja5.Cells(ipoint, 12) = Deditarimporte 'importe de ejecucion pres

Liii))

Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format( Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6)

Local

End If If Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 2).Formula stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Liiii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

End If ipoint = ipoint + 1 End If Bok2 = False 'Bok = False End If

se4) > 0)) Then

TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy iindice4 = 1 Scadena4 = "=" imarca4 = 0 Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4))

en .Trim(Hoja4.Cells(i4, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings D_puntero = j + ipuntero + 1 ipuntero4 = j Exit For End If Next j End If Bmarcasalto2 = True

Mdulo9 - 45 Bok2 = False If Iajusta < 4 Then Iajusta = 4 If Hoja4.Cells(D_puntero, 4) = "C" Then subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = gs.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

Else )

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssc" Bok1 = True Bnoentro1 = True ipoint = ipoint + 1

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1) Dmedicion = Strings.format(Dmedicion, format(Lii)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

umen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = trings.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & S Strings.format(iindice4 + 1, "00")

version.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena4 = Strings.Trim(Scadena4) + "+M" & Strings.Trim(Con Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint,

ion presupuesto

11).NumberFormat = format(Li) 12).NumberFormat = format(Lii) 13).NumberFormat = format(Liii) 12) = Deditarimporte 'importe de ejecuc

format(Liii))

Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6)

n .FormulaLocal

End If If Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 2) <> "" The

stemp1 = Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 2) stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Liiii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

Mdulo9 - 46 End If ipoint = ipoint + 1 End If Bok1 = False End If '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy iindice5 = 1 Scadena5 = "=" Bnoentro = False imarca5 = 0 Do While i5 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5, imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4))

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = D_puntero = j + ipuntero + 1 ipuntero5 = j Exit For End If Next j End If Bmarcasalto1 = True Bok1 = False If Iajusta < 5 Then Iajusta = 5 If Hoja4.Cells(D_puntero, 4) = "C" Then

resumen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") Strings.format(iindice4, "00")

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssc" Bok = True Bnoentro = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i5, 7 + Itipo_de_proyecto

Else * 3 + 1)) Li))

Dmedicion = Strings.format(Dmedicion, format(Lii)) Deditarimporte = Strings.format(Deditarimporte, format( If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Else

Then

' el resumen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & 00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, " Strings.format(iindice4, "

Mdulo9 - 47

Trim(Conversion.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena5 = Strings.Trim(Scadena5) + "+M" & Strings.

Hoja5.Cells(ipoint, 11).NumberFormat = format(Li) Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 13).NumberFormat = format(Liii)

e ejecucion presupuesto

Hoja5.Cells(ipoint, 12) = Deditarimporte 'importe d

Liii) edicion, format(Liii))

Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion,

Deditarimporte = Strings.format(Deditarimporte * Dm

6)

Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero,

> "" Then * 3 + 2).FormulaLocal

End If If Hoja4.Cells(i5, 7 + Itipo_de_proyecto * 3 + 2) < stemp1 = Hoja4.Cells(i5, 7 + Itipo_de_proyecto stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Liiii)

Else Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint,

End If ipoint = ipoint + 1 End If Bok = True End If

lls(i6, 1) - TBase6) > 0)) Then

TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy iindice6 = 1 Scadena6 = "=" imarca6 = 0 Do While i6 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce imarca6 = imarca6 + 1 D_puntero = CDbl(Hoja4.Cells(i6, 4))

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + D_puntero = j + ipuntero + 1 ipuntero6 = j Exit For End If Next j End If Bmarcasalto = True

Mdulo9 - 48 Bok = False If Iajusta < 6 Then Iajusta = 6 If Hoja4.Cells(D_puntero, 4) = "C" Then 3) ' el resumen subcapitulo 1) 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 2) = Strings.format(iindice 1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice 4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssssc" Bo = True Bnoentr = True ipoint = ipoint + 1

Else ) royecto * 3 + 1)) i)) format(Li)) Then te = 0) Then

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)

Dmedicion = CDbl(Hoja4.Cells(i6, 7 + Itipo_de_p

Dmedicion = Strings.format(Dmedicion, format(Li

Deditarimporte = Strings.format(Deditarimporte,

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0)

ElseIf (B_Pres_Solo_Con_Precio And Deditarimpor Else

ero, 3) ' el resumen subcapitulo ero, 1) ero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 1) = "p" Scadena6 = Strings.Trim(Scadena6) + "+M" &

Strings.Trim(Conversion.Str(ipoint)) at(Li) at(Lii) at(Liii) mporte de ejecucion presupuesto edicion, Liii) rte * Dmedicion, format(Liii))

Hoja5.Cells(ipoint, 11).NumberFormat = form

Hoja5.Cells(ipoint, 12).NumberFormat = form

Hoja5.Cells(ipoint, 13).NumberFormat = form

Hoja5.Cells(ipoint, 12) = Deditarimporte 'i

Hoja5.Cells(ipoint, 11) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dm

Deditarimporte = Strings.format(Deditarimpo

Hoja5.Cells(ipoint, 13) = Deditarimporte If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_

Mdulo9 - 49 puntero, 6) End If If Hoja4.Cells(i6, 7 + Itipo_de_proyecto *

3 + 2) <> "" Then royecto * 3 + 2).FormulaLocal

stemp1 = Hoja4.Cells(i6, 7 + Itipo_de_p

iii)

stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Li Else

ipoint, Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion,

End If ipoint = ipoint + 1 End If Bo = True End If '** 'imarca6 TBase7 = i7 = 1 + iindice7 Scadena7

(TBase6 + imarca6) * 100 D_Proy = 1 = "="

Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

Do While i7 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And (( 'imarca7 = imarca7 + 1 D_puntero = CDbl(Hoja4.Cells(i7, 4))

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu D_puntero = j + ipuntero + 1 ipuntero7 = j Exit For End If Next j End If Bmarcasalt = True Bo = False If Iajusta < 7 Then Iajusta = 7 If Hoja4.Cells(D_puntero, 4) = "C" Then

puntero, 3) ' el resumen subcapitulo puntero, 1) puntero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 2) = Strings.format (iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format (iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.fo rmat(iindice7 + 1, "00") iindice7 = iindice7 + 1

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssssc" ipoint = ipoint + 1

Mdulo9 - 50 Else tero, 5)) ipo_de_proyecto * 3 + 1)) ormat(Lii)) importe, format(Li)) ion = 0) Then tarimporte = 0) Then

Deditarimporte = CDbl(Hoja4.Cells(D_pun

Dmedicion = CDbl(Hoja4.Cells(i7, 7 + It

Dmedicion = Strings.format(Dmedicion, f

Deditarimporte = Strings.format(Deditar

If (B_Pres_Solo_Con_Medicion And Dmedic

ElseIf (B_Pres_Solo_Con_Precio And Dedi Else

s(D_puntero, 3) ' el resumen subcapitulo s(D_puntero, 1) s(D_puntero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

Hoja5.Cells(ipoint, 3) = Hoja4.Cell

Hoja5.Cells(ipoint, 4) = Hoja4.Cell

Hoja5.Cells(ipoint, 2) = Strings.fo rmat(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.fo rmat(iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & String s.format(iindice7 + 1, "00") iindice7 = iindice7 + 1

"+M" & Strings.Trim(Conversion.Str(ipoint)) t = format(Li) t = format(Lii) t = format(Liii) porte 'importe de ejecucion presupuesto rte * Dmedicion, Liii) itarimporte * Dmedicion, format(Liii)) porte en = True ) ) e Cells(D_puntero, 6)

Hoja5.Cells(ipoint, 1) = "p" Scadena7 = Strings.Trim(Scadena7) +

Hoja5.Cells(ipoint, 11).NumberForma

Hoja5.Cells(ipoint, 12).NumberForma

Hoja5.Cells(ipoint, 13).NumberForma

Hoja5.Cells(ipoint, 11) = Deditarim

Hoja5.Cells(ipoint, 12) = Dmedicion 'Deditarimporte = Round(Deditarimpo

Deditarimporte = Strings.format(Ded

Hoja5.Cells(ipoint, 13) = Deditarim

If B_Solo_texto_resumido = False Th

ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText

Set RightCell = Cells(ipoint, 5

Set LeftCell = Cells(ipoint, 10

Range(RightCell, LeftCell).Merg

Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4. End If

yecto * 3 + 2) <> "" Then ipo_de_proyecto * 3 + 2).FormulaLocal ).Row umn

If Hoja4.Cells(i7, 7 + Itipo_de_pro

stemp1 = Hoja4.Cells(i7, 7 + It

stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1

pos_med_col = Range(stemp1).Col pos_med_col = pos_med_col - 1 ipoint = ipoint + 1

Mdulo9 - 51 , Lii, Liiii)

ipoint = 1 + inf_med_des(ipoint Else

edicion, ipoint, Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dm

End If ipoint = ipoint + 1 End If End If End If i7 = i7 + 1

****

Loop '**************************************************

Trim(Conversion.Str(ipoint)) ntero6 + ipuntero + 1, 3)

End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True Hoja5.Cells(ipoint, 1) = "tsssssc" Scadena6 = Strings.Trim(Scadena6) + "+M" & Strings.

Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipu

ntero6 + ipuntero + 1, 3)

Hoja5.Cells(ipoint, 5).Select If Scadena7 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena7 End If Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tsssssc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipu Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i6 = i6 + 1 Bnoentr = False

Loop

version.Str(ipoint)) ipuntero + 1, 3)

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True Hoja5.Cells(ipoint, 1) = "tssssc" Scadena5 = Strings.Trim(Scadena5) + "+M" & Strings.Trim(Con

Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero5 + Hoja5.Cells(ipoint, 5).Select If Scadena6 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else

Mdulo9 - 52

ipuntero + 1, 3)

Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena6 End If Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tssssc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero5 + Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i5 = i5 + 1 Bnoentro = False Loop

Str(ipoint)) o + 1, 3)

End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True 'no estaba_creo que era un error Hoja5.Cells(ipoint, 1) = "tsssc" Scadena4 = Strings.Trim(Scadena4) + "+M" & Strings.Trim(Conversion.

Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero4 + ipunter Hoja5.Cells(ipoint, 5).Select If Scadena5 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena5 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2

o + 1, 3)

ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False Hoja5.Cells(ipoint, 1) = "tsssc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero4 + ipunter Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 '******************************************************** End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

End If If Bmarcasalto2 = True Then 'Bmarcasalto = False Bmarcasalto2 = False Bnoentro2 = True 'Bnoentro = True 'Bok = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tssc" Scadena3 = Strings.Trim(Scadena3) + "+M" & Strings.Trim(Conversion.Str(ipoi

Mdulo9 - 53 nt)) )

Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3

Hoja5.Cells(ipoint, 5).Select If Scadena4 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena4 End If Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tssc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, 3 Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.Copy Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro2 = False

Loop

End If If Bmarcasalto3 = True Then Bmarcasalto3 = False Bnoentro3 = True Bok3 = True 'no estaba, creo que es un error Hoja5.Cells(ipoint, 1) = "tsc" Scadena2 = Strings.Trim(Scadena2) + "+M" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select If Scadena3 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena3 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False Hoja5.Cells(ipoint, 1) = "tsc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then Bmarcasalto4 = False Bnoentro4 = True Bok4 = True Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+M" & Strings.Trim(Conversion.Str(ipoint))

Mdulo9 - 54 Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select If Scadena2 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena2 End If Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False Hoja5.Cells(ipoint, 1) = "tc" Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro4 = False

Loop

Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 5) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 13).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 13).FormulaLocal = Scadena1 End If Hoja5.Cells(ipoint, 13).Select Selection.EntireRow.Select Selection.Font.Bold = True With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With 'Hoja4.Activate

End Sub Public Sub pres_presupuesto_plano(ByVal Li As Integer, ByVal Lii As Integer, ByVal Liii As Integer) Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim i1b, i2b, i3b, i4b, i5b, i6b, i7b As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bok5, Bo As Double Dim Dim Dim Dim Dim Dim Dim Dim Scadena1, Scadena2, Scadena3, Scadena4, Scadena5, Scadena6, Scadena7 As String coefprod As Double NextCell As Range CurrentCell As Range Deditarimporte As Double Dmedicion As Double format(0 To 4) As String D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2

Mdulo9 - 55 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 Scadena2 Scadena3 Scadena4 Scadena5 Scadena6 = = = = = = "=" "=" "=" "=" "=" "="

Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("B:B").ColumnWidth = 10 Columns("D:D").ColumnWidth = 4 Columns("E:E").ColumnWidth = 20 Columns("F:H").ColumnWidth = 10 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 1 Bnoentro4 = False i1 = 1 + D_Proy i1b = 0 Do While i1 <= Ipuntos + D_Proy If i1b <> 0 And i1b + 1 <> i1 Then Exit Do 1) 2) 3) 4) 5) 6) 7) 8) = = = = = = = = "Des" 'Descriptor "numero" "Cdigo" "UM" "Resumen" "Medicion" "Precio" "Importe"

Mdulo9 - 56 If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then i1b = i1 imarca1 = imarca1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4))

) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) D_puntero = j + ipuntero + 1 Exit For End If Next j End If If Iajusta < 1 Then Iajusta = 1 If Strings.Trim(Hoja4.Cells(i1, 3)) = "C" Then If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "c" Bok4 = True Bnoentro4 = True ipoint = ipoint + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 3) = Hoja4.Cells(D_puntero, 1) 4) = Hoja4.Cells(D_puntero, 2) 2) = Strings.format((iindice1 + 1), "00") + 1 "+H" & Strings.Trim(Conversion.Str(ipoint)) = format(Li) = format(Lii) = format(Liii) 'importe de ejecucion presupuesto

Else

Hoja5.Cells(ipoint, 1) = "p" Scadena1 = Strings.Trim(Scadena1) + Hoja5.Cells(ipoint, 7).NumberFormat Hoja5.Cells(ipoint, 6).NumberFormat Hoja5.Cells(ipoint, 8).NumberFormat

Hoja5.Cells(ipoint, 7) = Deditarimporte

Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok4 = False

Mdulo9 - 57 End If ipoint = ipoint + 1 TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy i2b = 0 Scadena2 = "=" Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If i2b <> 0 And i2b + 1 <> i2 Then Exit Do If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then i2b = i2 imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4))

s(i2, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto4 = True Bok4 = False If Iajusta < 2 Then Iajusta = 2 If Strings.Trim(Hoja4.Cells(i2, 3)) = "C" Then

e2 + 1, "00")

If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 5).Font.Bold = True Bok3 = True Bnoentro3 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 5) 3) 4) 2) = = = =

Else

ndice2 + 1, "00")

Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strings.format(ii

iindice2 = iindice2 + 1

nt))

Hoja5.Cells(ipoint, 1) = "p" Scadena2 = Strings.Trim(Scadena2) + "+H" & Strings.Trim(Conversion.Str(ipoi

Mdulo9 - 58 Hoja5.Cells(ipoint, 7).NumberFormat = format(Li) Hoja5.Cells(ipoint, 6).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii) Hoja5.Cells(ipoint, 7) = Deditarimporte 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok3 = False 'Bok1 = False

)) Then

End If ipoint = ipoint + 1 TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy i3b = 0 iindice3 = 0 Scadena3 = "=" Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If i3b <> 0 And i3b + 1 <> i3 Then Exit Do If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0 i3b = i3 imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4))

ja4.Cells(i3, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto3 = True Bok3 = False If Iajusta < 3 Then Iajusta = 3 If Strings.Trim(Hoja4.Cells(i3, 3)) = "C" Then

capitulo

If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen sub

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssc" Bok2 = True Bnoentro2 = True ipoint = ipoint + 1

Else

Mdulo9 - 59 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else capitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen sub

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1

Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena3 = Strings.Trim(Scadena3) + "+H" & Strings.Trim(Conversion. Hoja5.Cells(ipoint, 7).NumberFormat = format(Li) Hoja5.Cells(ipoint, 6).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

puesto

Hoja5.Cells(ipoint, 7) = Deditarimporte 'importe de ejecucion presu

Liii))

Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format( Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok2 = False End If ipoint = ipoint + 1 TBase4 = (TBase3 + imarca3) * 100 imarca4 = 0 i4 = 1 + D_Proy i4b = 0 iindice4 = 1 Scadena4 = "="

se4) > 0)) Then

Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If i4b <> 0 And i4b + 1 <> i4 Then Exit Do If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

en .Trim(Hoja4.Cells(i4, 2)) Then

i4b = i4 imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto2 = True Bok2 = False If Iajusta < 4 Then Iajusta = 4

Mdulo9 - 60

umen subcapitulo

If Strings.Trim(Hoja4.Cells(i4, 3)) = "C" Then If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

End If Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = gs.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

Else )

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssc" Bok1 = True Bnoentro1 = True ipoint = ipoint + 1

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

umen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = trings.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & S Strings.format(iindice4 + 1, "00")

version.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena4 = Strings.Trim(Scadena4) + "+H" & Strings.Trim(Con Hoja5.Cells(ipoint, 7).NumberFormat = format(Li) Hoja5.Cells(ipoint, 6).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

on presupuesto

Hoja5.Cells(ipoint, 7) = Deditarimporte 'importe de ejecuci

format(Liii))

Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok1 = False End If ipoint = ipoint + 1 '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy i5b = 0 imarca5 = 0 iindice5 = 1 Scadena5 = "=" Bnoentro = False

Mdulo9 - 61 Do While i5 <= Ipuntos + D_Proy If i5b <> 0 And i5b + 1 <> i5 Then Exit Do If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5,

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then

i5b = i5 imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto1 = True Bok1 = False If Iajusta < 5 Then Iajusta = 5 If Strings.Trim(Hoja4.Cells(i5, 3)) = "C" Then If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

' el resumen subcapitulo

End If Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") Strings.format(iindice4, "00")

Else * 3 + 1)) Li))

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssc" Bok = True Bnoentro = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i5, 7 + Itipo_de_proyecto

Deditarimporte = Strings.format(Deditarimporte, format( Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Else

Then

' el resumen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & 00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, " Strings.format(iindice4, "

Trim(Conversion.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena5 = Strings.Trim(Scadena5) + "+H" & Strings. Hoja5.Cells(ipoint, 7).NumberFormat = format(Li) Hoja5.Cells(ipoint, 6).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

ejecucion presupuesto

Hoja5.Cells(ipoint, 7) = Deditarimporte 'importe de Hoja5.Cells(ipoint, 6) = Dmedicion

Mdulo9 - 62 Liii) edicion, format(Liii))

'Deditarimporte = Round(Deditarimporte * Dmedicion,

Deditarimporte = Strings.format(Deditarimporte * Dm Hoja5.Cells(ipoint, 8) = Deditarimporte

6)

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero,

lls(i6, 1) - TBase6) > 0)) Then

ipoint = ipoint + 1 End If End If Bok = False End If ipoint = ipoint + 1 TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy i6b = 0 imarca6 = 0 iindice6 = 1 Scadena6 = "=" Do While i6 <= Ipuntos + D_Proy If i6b <> 0 And i6b + 1 <> i6 Then Exit Do If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce i6b = i6 imarca6 = imarca6 + 1 D_puntero = CDbl(Hoja4.Cells(i6, 4))

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto = True Bok = False If Iajusta < 6 Then Iajusta = 6 If Strings.Trim(Hoja4.Cells(i6, 3)) = "C" Then

ero, 6) ero, 3) ' el resumen subcapitulo 1) 2)

If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 2) = Strings.format(iindice 1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice 4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssssc" ipoint = ipoint + 1 Bo = True

Else ) royecto * 3 + 1)) format(Li))

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)

Dmedicion = CDbl(Hoja4.Cells(i6, 7 + Itipo_de_p

Deditarimporte = Strings.format(Deditarimporte,

Mdulo9 - 63 i)) Then te = 0) Then

Dmedicion = Strings.format(Dmedicion, format(Li

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0)

ElseIf (B_Pres_Solo_Con_Precio And Deditarimpor Else

ero, 3) ' el resumen subcapitulo ero, 1) ero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 1) = "p" Scadena6 = Strings.Trim(Scadena6) + "+H" &

Strings.Trim(Conversion.Str(ipoint)) t(Li) t(Lii) t(Liii) porte de ejecucion presupuesto

Hoja5.Cells(ipoint, 7).NumberFormat = forma

Hoja5.Cells(ipoint, 6).NumberFormat = forma

Hoja5.Cells(ipoint, 8).NumberFormat = forma

Hoja5.Cells(ipoint, 7) = Deditarimporte 'im

edicion, Liii) rte * Dmedicion, format(Liii))

Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dm

Deditarimporte = Strings.format(Deditarimpo

puntero, 6)

Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_

****

ipoint = ipoint + 1 End If End If Bo = False End If ipoint = ipoint + 1 '**************************************************

Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

TBase7 = (TBase6 + imarca6) * 100 i7 = 1 + D_Proy iindice7 = 1 Scadena7 = "=" Do While i7 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And (( D_puntero = CDbl(Hoja4.Cells(i7, 4))

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalt = True

Mdulo9 - 64 Bo = False

hen

If Iajusta < 7 Then Iajusta = 7 If Strings.Trim(Hoja4.Cells(i7, 3)) = "C" T

s(D_puntero, 6) s(D_puntero, 3) ' el resumen subcapitulo puntero, 1) puntero, 2)

If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cell Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 2) = Strings.format (iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format (iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.fo rmat(iindice7 + 1, "00") iindice7 = iindice7 + 1

Else tero, 5)) ipo_de_proyecto * 3 + 1)) importe, format(Li)) ormat(Lii)) ion = 0) Then tarimporte = 0) Then

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssssc" ipoint = ipoint + 1

Deditarimporte = CDbl(Hoja4.Cells(D_pun

Dmedicion = CDbl(Hoja4.Cells(i7, 7 + It

Deditarimporte = Strings.format(Deditar

Dmedicion = Strings.format(Dmedicion, f

If (B_Pres_Solo_Con_Medicion And Dmedic

ElseIf (B_Pres_Solo_Con_Precio And Dedi Else

s(D_puntero, 3) ' el resumen subcapitulo s(D_puntero, 1) s(D_puntero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

Hoja5.Cells(ipoint, 3) = Hoja4.Cell

Hoja5.Cells(ipoint, 4) = Hoja4.Cell

Hoja5.Cells(ipoint, 2) = Strings.fo rmat(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.fo rmat(iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & String s.format(iindice7 + 1, "00") iindice7 = iindice7 + 1

"+H" & Strings.Trim(Conversion.Str(ipoint)) = format(Li) = format(Lii) = format(Liii) orte 'importe de ejecucion presupuesto

Hoja5.Cells(ipoint, 1) = "p" Scadena7 = Strings.Trim(Scadena7) +

Hoja5.Cells(ipoint, 7).NumberFormat

Hoja5.Cells(ipoint, 6).NumberFormat

Hoja5.Cells(ipoint, 8).NumberFormat

Hoja5.Cells(ipoint, 7) = Deditarimp

rte * Dmedicion, Liii) itarimporte * Dmedicion, format(Liii)) orte

Hoja5.Cells(ipoint, 6) = Dmedicion 'Deditarimporte = Round(Deditarimpo

Deditarimporte = Strings.format(Ded

Hoja5.Cells(ipoint, 8) = Deditarimp ipoint = ipoint + 1

Mdulo9 - 65 en Cells(D_puntero, 6)

If B_Solo_texto_resumido = False Th

Hoja5.Cells(ipoint, 5) = Hoja4. ipoint = ipoint + 1 End If End If End If ipoint = ipoint + 1 End If i7 = i7 + 1

Loop 'End If 'ESTE ESTA EN DUDA

Trim(Conversion.Str(ipoint))

'FINAL INSERCION End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True Hoja5.Cells(ipoint, 1) = "tsssssc" Scadena6 = Strings.Trim(Scadena6) + "+H" & Strings.

= xlContinuous yle = xlContinuous

Hoja5.Cells(ipoint, 5) = "Total Cap." If Scadena7 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena7 End If Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineSt ipoint = ipoint + 2 ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tsssssc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0"

= xlContinuous yle = xlContinuous

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineSt ipoint = ipoint + 2 End If i6 = i6 + 1 Bnoentr = False

Loop

version.Str(ipoint))

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True Hoja5.Cells(ipoint, 1) = "tssssc" Scadena5 = Strings.Trim(Scadena5) + "+H" & Strings.Trim(Con Hoja5.Cells(ipoint, 5) = "Total Cap." If Scadena6 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena6 End If Hoja5.Cells(ipoint, 5).Font.Bold = True

Mdulo9 - 66

tinuous Continuous

Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlCon

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xl ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tssssc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0"

tinuous Continuous

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlCon

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xl ipoint = ipoint + 2 End If i5 = i5 + 1 Bnoentro = False Loop

Str(ipoint))

End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True 'no estaba_creo que era un error Hoja5.Cells(ipoint, 1) = "tsssc" Scadena4 = Strings.Trim(Scadena4) + "+H" & Strings.Trim(Conversion.

us

Hoja5.Cells(ipoint, 5) = "Total Cap." If Scadena5 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena5 End If Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuo ipoint = ipoint + 2

us

ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False Hoja5.Cells(ipoint, 1) = "tsssc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuo ipoint = ipoint + 2 '******************************************************** End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

nt))

End If If Bmarcasalto2 = True Then Bmarcasalto2 = False Bnoentro2 = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tssc" Scadena3 = Strings.Trim(Scadena3) + "+H" & Strings.Trim(Conversion.Str(ipoi

Mdulo9 - 67 Hoja5.Cells(ipoint, 5) = "Total Cap. " If Scadena4 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena4 End If Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tssc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro2 = False 5).Font.Bold = True 8).Font.Bold = True 8).Borders(xlEdgeTop).LineStyle = xlContinuous 8).Borders(xlEdgeBottom).LineStyle = xlContinuous

Loop

End If If Bmarcasalto3 = True Then Bmarcasalto3 = False Bnoentro3 = True Bok3 = True 'no estaba, creo que es un error Hoja5.Cells(ipoint, 1) = "tsc" Scadena2 = Strings.Trim(Scadena2) + "+H" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 5) = "Total Cap." If Scadena3 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena3 End If Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False Hoja5.Cells(ipoint, 1) = "tsc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then Bmarcasalto4 = False Bnoentro4 = True Bok4 = True Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+H" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 5) = "Total Cap." If Scadena2 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0"

Mdulo9 - 68 Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena2 End If Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 2 5).Font.Bold = True 8).Font.Bold = True 8).Borders(xlEdgeTop).LineStyle = xlContinuous 8).Borders(xlEdgeBottom).LineStyle = xlContinuous

Loop

ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False Hoja5.Cells(ipoint, 1) = "tc" Hoja5.Cells(ipoint, 5) = "Total Cap." Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro4 = False

Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 5) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena1 End If Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True End Sub Public Sub med_corta(ByVal Lii As Integer) Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bok5, Bo As Double Dim coefprod As Double Dim NextCell As Range Dim RightCell As Range Dim LeftCell As Range Dim CurrentCell As Range Dim Deditarimporte As Double Dim Dmedicion As Double Dim format(0 To 4) As String Dim D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else

Mdulo9 - 69 Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("D:H").ColumnWidth = 4 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 1 Bnoentro4 = False 'Bnoentro2 = False i1 = 1 + D_Proy Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) 1) = "Des" 'Descriptor 2) = "numero" 3) = "Cdigo" 4) = "UM" 5) = "Resumen" 12) = "Medicion"

) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) D_puntero = j + ipuntero + 1 Exit For End If Next j End If If Iajusta < 1 Then Iajusta = 1 If Strings.Trim(Hoja4.Cells(i1, 3)) = "C" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1

Mdulo9 - 70 Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 1) = "c" Selection.Font.Bold = True Bok4 = True Bnoentro4 = True ipoint = ipoint + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) Dmedicion = Round(CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)), Lii) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen 3) = Hoja4.Cells(D_puntero, 1) 4) = Hoja4.Cells(D_puntero, 2) 2) = Strings.format((iindice1 + 1), "00") + 1 1) = "p" 12).NumberFormat = format(Lii) 12) = Dmedicion

Else

If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If End If Bok4 = False End If ipoint = ipoint + 1 TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4))

s(i2, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto4 = True Bok4 = False

e2, "00")

If Iajusta < 2 Then Iajusta = 2 If Strings.Trim(Hoja4.Cells(i2, 3)) = "C" Then Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Selection.Font.Bold + 1 7).Select 1) = "sc" = True

Mdulo9 - 71 Bok3 = True Bnoentro3 = True ipoint = ipoint + 1 Dmedicion = Round(CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)), Lii) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

Else

ndice2 + 1, "00")

Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(ii iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If End If Bok3 = False

End If ipoint = ipoint + 1 TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0

)) Then

Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0 imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4))

ja4.Cells(i3, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto3 = True Bok3 = False If Iajusta < 3 Then Iajusta = 3

tulo

If Strings.Trim(Hoja4.Cells(i3, 3)) = "C" Then Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapi

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "ssc" Selection.Font.Bold = True Bok2 = True Bnoentro2 = True ipoint = ipoint + 1

Mdulo9 - 72 Else Lii)

Dmedicion = Round(CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)), If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If End If Bok2 = False End If ipoint = ipoint + 1 TBase4 = (TBase3 + imarca3) * 100 imarca4 = 0 i4 = 1 + D_Proy iindice4 = 1

se4) > 0)) Then

Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

en

imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

.Trim(Hoja4.Cells(i4, 2)) Then

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto2 = True Bok2 = False

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strin gs.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "sssc" Selection.Font.Bold = True Bok1 = True Bnoentro1 = True ipoint = ipoint + 1 Dmedicion = Round(CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto *

subcapitulo

If Iajusta < 4 Then Iajusta = 4 If Strings.Trim(Hoja4.Cells(i4, 3)) = "C" Then Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_puntero, 3) ' el resumen

Else 3 + 1)), Lii)

Mdulo9 - 73 If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then Else umen

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & S trings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If End If Bok1 = False End If ipoint = ipoint + 1 '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy imarca5 = 0 iindice5 = 1 Bnoentro = False Do While i5 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5,

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then

imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto1 = True Bok1 = False

resumen subcapitulo

If Iajusta < 5 Then Iajusta = 5 If Strings.Trim(Hoja4.Cells(i5, 3)) = "C" Then Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_puntero, 3) ' el

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "ssssc" Selection.Font.Bold = True Bok = True Bnoentro = True ipoint = ipoint + 1

Else yecto * 3 + 1)), Lii)

Dmedicion = Round(CDbl(Hoja4.Cells(i5, 7 + Itipo_de_pro If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

Mdulo9 - 74 Else ' el resumen Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, " 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, " 00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) End If

lls(i6, 1) - TBase6) > 0)) Then

End If Bok = False End If ipoint = ipoint + 1 TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy imarca6 = 0 iindice6 = 1 Do While i6 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce imarca6 = imarca6 + 1 D_puntero = CDbl(Hoja4.Cells(i6, 4))

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalto = True Bok = False

3) ' el resumen subcapitulo 1) 2)

If Iajusta < 6 Then Iajusta = 6 If Strings.Trim(Hoja4.Cells(i6, 3)) = "C" Then Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 2) = Strings.format(iindice 1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice 4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "sssssc" Selection.Font.Bold = True ipoint = ipoint + 1 Bo = True

Else o_de_proyecto * 3 + 1)), Lii) Then

Dmedicion = Round(CDbl(Hoja4.Cells(i6, 7 + Itip

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0)

Mdulo9 - 75 Else ero, 3) ' el resumen ero, 1) ero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberFormat = form at(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5) Set LeftCell = Cells(ipoint, 11) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_ puntero, 6) End If

****

End If Bo = False End If ipoint = ipoint + 1 '**************************************************

Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

TBase7 = (TBase6 + imarca6) * 100 i7 = 1 + D_Proy iindice7 = 1 Do While i7 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And (( D_puntero = CDbl(Hoja4.Cells(i7, 4))

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu D_puntero = j + ipuntero + 1 Exit For End If Next j End If Bmarcasalt = True Bo = False

hen puntero, 3) ' el resumen subcapitulo puntero, 1) puntero, 2)

If Iajusta < 7 Then Iajusta = 7 If Strings.Trim(Hoja4.Cells(i7, 3)) = "C" T

Hoja5.Cells(ipoint, 7) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 2) = Strings.format (iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format (iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.fo rmat(iindice7 + 1, "00") iindice7 = iindice7 + 1 Hoja5.Cells(ipoint, 7).Select Hoja5.Cells(ipoint, 1) = "ssssssc" Selection.Font.Bold = True ipoint = ipoint + 1

Mdulo9 - 76 Else 7 + Itipo_de_proyecto * 3 + 1)), Lii) ion = 0) Then Dmedicion = Round(CDbl(Hoja4.Cells(i7,

If (B_Pres_Solo_Con_Medicion And Dmedic Else

s(D_puntero, 3) ' el resumen s(D_puntero, 1) s(D_puntero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

Hoja5.Cells(ipoint, 3) = Hoja4.Cell

Hoja5.Cells(ipoint, 4) = Hoja4.Cell

Hoja5.Cells(ipoint, 2) = Strings.fo rmat(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.fo rmat(iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & String s.format(iindice7 + 1, "00") iindice7 = iindice7 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 12).NumberForma t = format(Lii) Hoja5.Cells(ipoint, 12) = Dmedicion If B_Solo_texto_resumido = False Th en ipoint = ipoint + 1 Hoja5.Cells(ipoint, 5).WrapText = True Set RightCell = Cells(ipoint, 5 ) Set LeftCell = Cells(ipoint, 11 ) Range(RightCell, LeftCell).Merg e Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4. Cells(D_puntero, 6) End If End If End If ipoint = ipoint + 1 End If i7 = i7 + 1

Loop 'End If 'ESTE ESTA EN DUDA

'FINAL INSERCION End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True ipoint = ipoint + 2 ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas ipoint = ipoint + 2 End If i6 = i6 + 1 Bnoentr = False

Loop

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas

Mdulo9 - 77 ipoint = ipoint + 2 End If i5 = i5 + 1 Bnoentro = False Loop End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True ipoint = ipoint + 2 ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False ipoint = ipoint + 2 '******************************************************** End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

End If If Bmarcasalto2 = True Then Bmarcasalto2 = False Bnoentro2 = True Bok2 = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro2 = False

Loop

End If If Bmarcasalto3 = True Then Bmarcasalto3 = False Bnoentro3 = True Bok3 = True ipoint = ipoint + 2 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False ipoint = ipoint + 2 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then Bmarcasalto4 = False Bnoentro4 = True Bok4 = True ipoint = ipoint + 2 ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro4 = False

Loop

Mdulo9 - 78

End Sub

Public Function inf_med_des(ByVal Linea As Double, ByVal Li As Integer, ByVal Lii As Integer) As In teger 'Li formado medicion parcial, Lii med descompuesta Dim j As Double Dim totalmedlinea As Double Dim totalmedpartida As Double Dim Da, Db, Dc, dd As Double Dim Stemp As String Dim formats(0 To 4) As String Dim RightCell As Range Dim LeftCell As Range formats(0) formats(1) formats(2) formats(3) formats(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Linea = Linea + 1 Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, 1) = "LR" 'Descriptor 3) = "Descripcin" 6) = "Unidades" 7) = "Largo" 8) = "Ancho" 9) = "Alto" 10) = "Parcial"

Hoja5.Rows(Linea).Font.Underline = xlUnderlineStyleSingle Linea = Linea + 2 totalmedlinea = 0 totalmedpartida = 0

j = 1 'Linea Bdescomposicionmed = False inf_med_des = Linea 'devuelve la lnea en la que deja el informe Do While Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionme dicion + 1, 5 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col) <> "" Or Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) <> "" Bdescomposicionmed = True If Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_col) <> "nuevalinea" Then Db = 0 Dc = 0 dd = 0 Da = 0 If Hoja1.Cells(j + posicionmedicion + 1, 10 + pos_med_col) = "" Then Hoja5.Cells(Linea, 6).NumberFormat = formats(Lii) Hoja5.Cells(Linea, 7).NumberFormat = formats(Lii) Hoja5.Cells(Linea, 8).NumberFormat = formats(Lii) Hoja5.Cells(Linea, 9).NumberFormat = formats(Lii) Hoja5.Cells(Linea, 10).NumberFormat = formats(Li) Hoja5.Cells(Linea, 1) = "m"

Set RightCell = Cells(Linea, 3) Set LeftCell = Cells(Linea, 5) Range(RightCell, LeftCell).Merge Hoja5.Cells(Linea, 3).VerticalAlignment = xlTop Hoja5.Cells(Linea, 3).WrapText = True Hoja5.Rows(Linea).HorizontalAlignment = xlJustify Hoja5.Cells(Linea, 3) = Strings.Trim(Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_

Mdulo9 - 79 col)) 'texto If Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col).Value = "" Then Da = 0 Else Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, Lii) Hoja5.Cells(Linea, 6) = Da 'UNIDAD End If If Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col).Value = "" Then Db = 0 Else Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 6 + pos_med_col)) Db = Round(Db, Lii) Hoja5.Cells(Linea, 7) = Db End If If Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col).Value = "" Then Dc = 0 Else Dc = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 7 + pos_med_col)) Dc = Round(Dc, Lii) Hoja5.Cells(Linea, 8) = Dc End If If Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col).Value = "" Then dd = 0 Else dd = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 8 + pos_med_col)) dd = Round(dd, Lii) Hoja5.Cells(Linea, 9) = dd End If If Da = 0 Then totalmedlinea = 0 Else If Db = 0 Then Db = 1 If Dc = 0 Then Dc = 1 If dd = 0 Then dd = 1 totalmedlinea = Da * Db * Dc * dd totalmedlinea = Round(totalmedlinea, Li) End If Hoja5.Cells(Linea, 10) = totalmedlinea

Else

col)) 'texto

'=============================================================================== '* ESTAMOS EN EL CASO DE QUE TENEMOS UNA REFERENCIA Hoja5.Cells(Linea, 1) = "mr" Hoja5.Cells(Linea, 3) = Strings.Trim(Hoja1.Cells(j + posicionmedicion + 1, 4 + pos_med_ Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, Hoja5.Cells(Linea, 6).NumberFormat = formats(Lii) 7).NumberFormat = formats(Lii) 8).NumberFormat = formats(Lii) 9).NumberFormat = formats(Lii) 10).NumberFormat = formats(Li)

If Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col).Value = "" Then Da = 0 Else Da = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 5 + pos_med_col)) Da = Round(Da, Lii) Hoja5.Cells(Linea, 6) = Da 'UNIDAD End If

Db = CDbl(Hoja1.Cells(j + posicionmedicion + 1, 11 + pos_med_col)) Db = Round(Db, Lii) If Db = 0 Then totalmedlinea = 0 Else If Da = 0 Then totalmedlinea = 0 Else totalmedlinea = Da * Db

Mdulo9 - 80 totalmedlinea = Round(totalmedlinea, Li) End If End If Hoja5.Cells(Linea, 7) = Db Hoja5.Cells(Linea, 10) = totalmedlinea End If j = j + 1 Linea = Linea + 1 Else Linea = Linea + 1 j = j + 1 totalmedlinea = 0

End If Loop inf_med_des = Linea 'devuelve la lnea en la que deja el informe End Function Public Function sin_inf_med_des(ByVal D_med As Double, ByVal Linea As Double, ByVal Li As Integer) As Integer Dim formats(0 To 4) As String

formats(0) formats(1) formats(2) formats(3) formats(4)

= = = = =

"#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Linea = Linea + 1 Hoja5.Cells(Linea, 1) = "LR" 'Descriptor Hoja5.Cells(Linea, 3) = "Descripcin" Hoja5.Cells(Linea, 6) = "Unidades" Hoja5.Cells(Linea, 7) = "Largo" Hoja5.Cells(Linea, 8) = "Ancho" Hoja5.Cells(Linea, 9) = "Alto" Hoja5.Cells(Linea, 10) = "Parcial" Hoja5.Rows(Linea).Font.Underline = xlUnderlineStyleSingle Linea = Linea + 2 Hoja5.Cells(Linea, 1) = "smd" Hoja5.Cells(Linea, 10).NumberFormat = formats(Li) Hoja5.Cells(Linea, 10) = D_med 'Linea = Linea + 1 sin_inf_med_des = Linea 'devuelve la lnea en la que deja el informe End Function Public Sub inf_med(ByVal Li As Integer, ByVal Lii As Integer) 'creo que falta un nivel Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6, imarca7 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim stemp1 As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bo As Double Dim ipuntero1, ipuntero2, ipuntero3, ipuntero4, ipuntero5, ipuntero6, ipuntero7 As Integer Dim NextCell, RightCell, LeftCell As Range

Mdulo9 - 81 Dim CurrentCell As Range Dim Dmedicion As Double Dim format(0 To 4) As String Dim D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 D_Proy = 0 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("E:E").ColumnWidth = 4 Columns("F:H").ColumnWidth = 10 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 1 Bnoentro4 = False 'Bnoentro2 = False i1 = 1 + D_Proy Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) 1) 2) 3) 4) 5) 6) = = = = = = "Des" 'Descriptor "numero" "Cdigo" "Medicion" "UM" "Resumen"

Mdulo9 - 82

) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) D_puntero = j + ipuntero + 1 ipuntero1 = j Exit For End If Next j End If If Iajusta < 1 Then Iajusta = 1 IFlagposition1 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "c" Bok4 = True Bnoentro4 = True ipoint = ipoint + 3 Else Dmedicion = Round(CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)), Li) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then Else Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 6) End If ipoint = ipoint + 1 If Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1

Mdulo9 - 83 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Lii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 10).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 3 End If Bok4 = False End If TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4))

s(i2, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell D_puntero = j + ipuntero + 1 ipuntero2 = j Exit For End If Next j End If Bmarcasalto4 = True Bok4 = False If Iajusta < 2 Then Iajusta = 2 IFlagposition2 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then

e2 + 1, "00")

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 6).Font.Bold = True Bok3 = True Bnoentro3 = True ipoint = ipoint + 3 Dmedicion = Round(CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)), Li) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

Else

Mdulo9 - 84 Else

ndice2 + 1, "00")

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(ii iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 6) End If ipoint = ipoint + 1 If Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 2).FormulaLocal stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Lii) Else ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 10).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 3 End If Bok3 = False End If

)) Then

TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0

imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho ja4.Cells(i3, 2)) Then D_puntero = j + ipuntero + 1 ipuntero3 = j Exit For End If Next j End If

Mdulo9 - 85 Bmarcasalto3 = True Bok3 = False If Iajusta < 3 Then Iajusta = 3 IFlagposition3 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then

tulo

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapi

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssc" Bok2 = True Bnoentro2 = True ipoint = ipoint + 3

Else Lii)

Dmedicion = Round(CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)), If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

itulo

Else Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen subcap

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.form at(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = format(Li) Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 6)

al

End If ipoint = ipoint + 1 If Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 2).FormulaLoc stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Lii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

End If Hoja5.Cells(ipoint, 1) = "tm"

Mdulo9 - 86

se4) > 0)) Then

Hoja5.Cells(ipoint, 10).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 10).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 3 End If Bok2 = False End If TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy imarca4 = 0 iindice4 = 1 Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

en .Trim(Hoja4.Cells(i4, 2)) Then

imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings D_puntero = j + ipuntero + 1 ipuntero4 = j Exit For End If Next j End If Bmarcasalto2 = True Bok2 = False

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 5) = Hoja5.Cells(ipoint, 2) = gs.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

subcapitulo

If Iajusta < 4 Then Iajusta = 4 IFlagposition4 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resumen

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

Else 3 + 1)), Li)

Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssc" Bok1 = True Bnoentro1 = True ipoint = ipoint + 3 Dmedicion = Round(CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

en subcapitulo

Else Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el resum = = = &

Hoja5.Cells(ipoint, 3) Hoja5.Cells(ipoint, 5) Hoja5.Cells(ipoint, 2) ings.format(iindice2, "00") & Strings.format(iindice3, "00")

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Str Strings.format(iindice4 + 1, "00")

Mdulo9 - 87 iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = format(Li) Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 6)

ormulaLocal

End If ipoint = ipoint + 1 If Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 2) <> "" Then stemp1 = Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 2).F stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Lii) ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint, Li)

Else

inuous ontinuous

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberFormat = format(Li) 'medicion Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).LineStyle = xlCont

Hoja5.Cells(ipoint, 10).Borders(xlEdgeBottom).LineStyle = xlC ipoint = ipoint + 3 End If Bok1 = False End If '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy imarca5 = 0 iindice5 = 1 Bnoentro = False Do While i5 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5,

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then

imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = D_puntero = j + ipuntero + 1 ipuntero5 = j Exit For End If Next j End If Bmarcasalto1 = True Bok1 = False If Iajusta < 5 Then Iajusta = 5 IFlagposition5 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then

Mdulo9 - 88

resumen subcapitulo

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3) ' el

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 5) = Hoja5.Cells(ipoint, 2) = & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") Strings.format(iindice4, "00")

Else yecto * 3 + 1)), Li)

Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssc" Bok = True Bnoentro = True ipoint = ipoint + 3

Dmedicion = Round(CDbl(Hoja4.Cells(i5, 7 + Itipo_de_pro If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then Else Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTop Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero, 3)

' el resumen subcapitulo

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 5) = Hoja5.Cells(ipoint, 2) = 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & 00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, " Strings.format(iindice4, "

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = format(Li)

6)

Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero,

> "" Then * 3 + 2).FormulaLocal

End If ipoint = ipoint + 1 If Hoja4.Cells(i5, 7 + Itipo_de_proyecto * 3 + 2) < stemp1 = Hoja4.Cells(i5, 7 + Itipo_de_proyecto stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Lii)

Else Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion, ipoint,

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberFormat = format(Li) '

Mdulo9 - 89 medicion

e = xlContinuous tyle = xlContinuous

Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).LineStyl

Hoja5.Cells(ipoint, 10).Borders(xlEdgeBottom).LineS ipoint = ipoint + 3 End If Bok = True End If

lls(i6, 1) - TBase6) > 0)) Then

TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy imarca6 = 0 iindice6 = 1 Bnoentr = False 'quita este Do While i6 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then

imarca6 = imarca6 + 1 D_puntero = CDbl(Hoja4.Cells(i6, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + D_puntero = j + ipuntero + 1 ipuntero6 = j Exit For End If Next j End If Bmarcasalto = True Bok = False If Iajusta < 6 Then Iajusta = 6 IFlagposition6 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then

p 3) ' el resumen subcapitulo 1) 2)

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = xlTo

Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 2) = Strings.format(iindice 1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice 4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssssc" Bo = True 'quita este Bnoentr = True 'quita este ipoint = ipoint + 3

Else o_de_proyecto * 3 + 1)), Li) Then

Dmedicion = Round(CDbl(Hoja4.Cells(i6, 7 + Itip

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Else

Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10)

Mdulo9 - 90 Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment =

xlTop ero, 3) ' el resumen subcapitulo ero, 1) ero, 2)

Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1

t(Li)

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat = forma

puntero, 6)

Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Then ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_ End If ipoint = ipoint + 1

3 + 2) <> "" Then royecto * 3 + 2).FormulaLocal

If Hoja4.Cells(i6, 7 + Itipo_de_proyecto *

stemp1 = Hoja4.Cells(i6, 7 + Itipo_de_p

i)

stemp1 = SolamenteRef(stemp1) posicionmedicion = Range(stemp1).Row pos_med_col = Range(stemp1).Column pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint, Li, Li Else

ipoint, Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dmedicion,

at(Li) 'medicion

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberFormat = form

LineStyle = xlContinuous m).LineStyle = xlContinuous

Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 10).Borders(xlEdgeTop).

Hoja5.Cells(ipoint, 10).Borders(xlEdgeBotto ipoint = ipoint + 3 End If Bo = True End If

****

'************************************************** TBase7 = (TBase6 + imarca6) * 100 i7 = 1 + D_Proy imarca7 = 0 iindice7 = 1 Do While i7 <= Ipuntos + D_Proy

If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And ((

Mdulo9 - 91 Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

imarca7 = imarca7 + 1 D_puntero = CDbl(Hoja4.Cells(i7, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu D_puntero = j + ipuntero + 1 ipuntero7 = j Exit For End If Next j End If Set RightCell = Cells(ipoint, 6) Set LeftCell = Cells(ipoint, 10) Range(RightCell, LeftCell).Merge Hoja5.Cells(ipoint, 6).VerticalAlignment = Hoja5.Cells(ipoint, 6).WrapText = True Bmarcasalt = True Bo = False

xlTop

ero, 3) ' el resumen subcapitulo ero, 1) ero, 2)

Hoja5.Cells(ipoint, 6) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.format (iindice7 + 1, "00") iindice7 = iindice7 + 1 If Iajusta < 7 Then Iajusta = 7 IFlagposition7 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Hoja5.Cells(ipoint, 6).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssssc" ipoint = ipoint + 3 Else Dmedicion = Round(CDbl(Hoja4.Cells(i7, 7 + Itipo_de_proyecto * 3 + 1)), Li) If (B_Pres_Solo_Con_Medicion And Dmedic ion = 0) Then Else = format(Li) en ) ) e = True Cells(D_puntero, 6)

Hoja5.Cells(ipoint, 1) = "p" Hoja5.Cells(ipoint, 4).NumberFormat

Hoja5.Cells(ipoint, 4) = Dmedicion If B_Solo_texto_resumido = False Th

ipoint = ipoint + 1 Set RightCell = Cells(ipoint, 6

Set LeftCell = Cells(ipoint, 10

Range(RightCell, LeftCell).Merg

Hoja5.Cells(ipoint, 6).WrapText

Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 6) = Hoja4.

yecto * 3 + 2) <> "" Then ipo_de_proyecto * 3 + 2).FormulaLocal

End If ipoint = ipoint + 1 If Hoja4.Cells(i7, 7 + Itipo_de_pro

stemp1 = Hoja4.Cells(i7, 7 + It stemp1 = SolamenteRef(stemp1)

Mdulo9 - 92 ).Row umn

posicionmedicion = Range(stemp1

pos_med_col = Range(stemp1).Col

, Li, Lii)

pos_med_col = pos_med_col - 1 ipoint = ipoint + 1 ipoint = 1 + inf_med_des(ipoint Else

edicion, ipoint, Li)

ipoint = ipoint + 1 ipoint = 1 + sin_inf_med_des(Dm

t = format(Li) 'medicion

End If Hoja5.Cells(ipoint, 1) = "tm" Hoja5.Cells(ipoint, 10).NumberForma

" dgeTop).LineStyle = xlContinuous dgeBottom).LineStyle = xlContinuous

Hoja5.Cells(ipoint, 10) = Dmedicion Hoja5.Rows(ipoint).Font.Bold = True Hoja5.Cells(ipoint, 9) = "Total ...

Hoja5.Cells(ipoint, 10).Borders(xlE

Hoja5.Cells(ipoint, 10).Borders(xlE ipoint = ipoint + 3 End If End If End If i7 = i7 + 1

Loop

Loop

End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True ipoint = ipoint + 2 ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas ipoint = ipoint + 2 End If i6 = i6 + 1 Bnoentr = False

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas ipoint = ipoint + 2 End If i5 = i5 + 1 Bnoentro = False Loop End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True 'no estaba_creo que era un error ipoint = ipoint + 2 ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False ipoint = ipoint + 2 '********************************************************

Mdulo9 - 93 End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

Loop

End If If Bmarcasalto2 = True Then Bmarcasalto2 = False Bnoentro2 = True Bok2 = True ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro2 = False

End If If Bmarcasalto3 = True Then Bmarcasalto3 = False Bnoentro3 = True Bok3 = True 'no estaba, creo que es un error ipoint = ipoint + 2 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False ipoint = ipoint + 2 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then Bmarcasalto4 = False Bnoentro4 = True Bok4 = True ipoint = ipoint + 2 ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro4 = False

Loop

With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With 'Hoja4.Activate End Sub Public Function enlazarlinea(ByVal Linea As Double, ByVal Slinea As String) As Double Dim Dtemp_2 As Double Dim n As Double Dtemp_2 = Hoja5.Cells(Rows.Count, 2).End(xlUp).Row enlazarlinea = 0 'quiere decir que no ha encontrado nada For n = Linea To Dtemp_2 If Strings.Trim(Hoja5.Cells(n, 2)) = Strings.Trim(Slinea) Then enlazarlinea = n Exit Function End If Next n

Mdulo9 - 94 'Hoja5.Range(Celda1, Celda4).Insert Shift:=xlDown 'Rows("1:1").Select 'Application.CutCopyMode = False 'Selection.Insert Shift:=xlDown Rows(Linea).Insert Shift:=xlDown Rows(Linea).Insert Shift:=xlDown

End Function Public Sub pres_presupuesto_doble(ByVal Li As Integer, ByVal Lii As Integer, ByVal Liii As Integer) Dim i As Double, j As Double Dim ipoint As Double Dim ipoint_temp As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim i1b, i2b, i3b, i4b, i5b, i6b, i7b As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim Stemp2 As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bo As Double Dim ipuntero1, ipuntero2, ipuntero3, ipuntero4, ipuntero5, ipuntero6 As Integer Dim Scadena1, Scadena2, Scadena3, Scadena4, Scadena5, Scadena6, Scadena7 As String Dim coefprod As Double Dim NextCell As Range Dim CurrentCell As Range Dim Deditarimporte As Double Dim Dmedicion As Double Dim format(0 To 4) As String Dim D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 Scadena2 Scadena3 Scadena4 Scadena5 Scadena6 = = = = = = "=" "=" "=" "=" "=" "="

Bnoentro = True Bnoentro1 = True

Mdulo9 - 95 Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("I:I").ColumnWidth = 1 'Columns("B:B").ColumnWidth = 10 Columns("K:K").ColumnWidth = 4 Columns("L:L").ColumnWidth = 20 Columns("M:O").ColumnWidth = 10 Columns("J:J").EntireColumn.NumberFormat = "@" Columns("J:J").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 1 10) 11) 12) 13) 14) 15) = = = = = = "Cdigo" "UM" "Resumen" "Medicion" "Precio" "Importe"

Bnoentro4 = False 'Bnoentro2 = False i1 = 1 + D_Proy i1b = 0 Do While i1 <= Ipuntos + D_Proy If i1b <> 0 And i1b + 1 <> i1 Then Exit Do If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then i1b = i1 imarca1 = imarca1 + 1 Stemp2 = Strings.format((iindice1 + 1), "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 D_puntero = CDbl(Hoja4.Cells(i1, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2) ) Then D_puntero = j + ipuntero + 1 ipuntero1 = j 'cuidado con esto (la j) que sirve para espresar total mov de t Exit For End If Next j End If If Iajusta < 1 Then Iajusta = 1 'IFlagposition1 = 1 If Strings.Trim(Hoja4.Cells(i1, 3)) = "C" Then 'If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 1) = "c" 'Selection.Font.Bold = True

Mdulo9 - 96 'Bok2 = True Bok4 = True 'Bnoentro2 = True Bnoentro4 = True ipoint = ipoint + 2 Dmedicion = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, 1) = "p" Scadena1 = Strings.Trim(Scadena1) + "+O" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 14).NumberFormat = format(Li) Hoja5.Cells(ipoint, 13).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 15).NumberFormat = format(Liii) Hoja5.Cells(ipoint, 14) = Deditarimporte 'importe de ejecucion presupuesto

Else

Hoja5.Cells(ipoint, 14) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) 'Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bok4 = False 'Bok2 = False End If

TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy i2b = 0 Scadena2 = "=" 'Bnoentro1 = False Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If i2b <> 0 And i2b + 1 <> i2 Then Exit Do If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then i2b = i2 imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell s(i2, 2)) Then D_puntero = j + ipuntero + 1 ipuntero2 = j 'cuidado con esto (la j) que sirve para espresar total mo v de t Exit For End If Next j

Mdulo9 - 97 End If Bmarcasalto4 = True 'Bok2 = False Bok4 = False If Iajusta < 2 Then Iajusta = 2 'IFlagposition2 = 1 If Strings.Trim(Hoja4.Cells(i2, 3)) = "C" Then 'If Hoja4.Cells(D_puntero, 4) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindice2 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitul End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 12).Font.Bold = True 'Selection.Font.Bold = True 'Bok1 = True Bok3 = True 'Bnoentro1 = True Bnoentro3 = True ipoint = ipoint + 2 Dmedicion = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

Else

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindice2 + 1, "00"

ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitul Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice2 = iindice2 + 1

nt))

Hoja5.Cells(ipoint, 1) = "p" Scadena2 = Strings.Trim(Scadena2) + "+O" & Strings.Trim(Conversion.Str(ipoi Hoja5.Cells(ipoint, 14).NumberFormat = format(Li) Hoja5.Cells(ipoint, 13).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 15).NumberFormat = format(Liii) Hoja5.Cells(ipoint, 14) = Deditarimporte 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1

Mdulo9 - 98 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bok3 = False 'Bok1 = False End If

)) Then

TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy i3b = 0 iindice3 = 0 Scadena3 = "=" Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If i3b <> 0 And i3b + 1 <> i3 Then Exit Do If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0

ja4.Cells(i3, 2)) Then total mov de t

i3b = i3 imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho D_puntero = j + ipuntero + 1 ipuntero3 = j 'cuidado con esto (la j) que sirve para espresar

.Cells(i3, 2)) Then

Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4 ' ipuntero3 = j ' Exit For ' End If 'Next j Bmarcasalto3 = True Bok3 = False If Iajusta < 3 Then Iajusta = 3 'IFlagposition3 = 1 If Strings.Trim(Hoja4.Cells(i3, 3)) = "C" Then 'If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindice2, "00" ) & Strings.format(iindice3 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 'Bok1 = False 'Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ' el resumen subcapitulo If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen su bcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 12).Font.Bold = True

Mdulo9 - 99 Hoja5.Cells(ipoint, 1) = "ssc" 'Selection.Font.Bold = True 'Bok = True Bok2 = True 'Bnoentro = True Bnoentro2 = True ipoint = ipoint + 2 Dmedicion = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

Else

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen su bcapitulo Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice3 = iindice3 + 1

Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena3 = Strings.Trim(Scadena3) + "+O" & Strings.Trim(Conversion. Hoja5.Cells(ipoint, 14).NumberFormat = format(Li) Hoja5.Cells(ipoint, 13).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 15).NumberFormat = format(Liii)

upuesto

Hoja5.Cells(ipoint, 14) = Deditarimporte 'importe de ejecucion pres

Liii))

Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(

se4) > 0)) Then

Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bok2 = False 'Bok = False End If TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy i4b = 0 iindice4 = 1 Scadena4 = "=" imarca4 = 0 Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If i4b <> 0 And i4b + 1 <> i4 Then Exit Do If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa

i4b = i4 imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

Mdulo9 - 100 en .Trim(Hoja4.Cells(i4, 2)) Then spresar total mov de t

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings

D_puntero = j + ipuntero + 1 ipuntero4 = j 'cuidado con esto (la j) que sirve para e Exit For End If Next j End If Bmarcasalto2 = True 'Bok = False Bok2 = False If Iajusta < 4 Then Iajusta = 4 'IFlagposition4 = 1 If Strings.Trim(Hoja4.Cells(i4, 3)) = "C" Then 'If Hoja4.Cells(D_puntero, 4) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindic e2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el re sumen subcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice4 = iindice4 + 1 Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssc" 'Selection.Font.Bold = True Bok1 = True Bnoentro1 = True ipoint = ipoint + 2

Else )

Dmedicion = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1) Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

Stemp2 = Strings.format(iindice1, "00") & Strings.format(ii ndice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el re sumen subcapitulo Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice4 = iindice4 + 1

version.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena4 = Strings.Trim(Scadena4) + "+O" & Strings.Trim(Con Hoja5.Cells(ipoint, 14).NumberFormat = format(Li)

Mdulo9 - 101 Hoja5.Cells(ipoint, 13).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 15).NumberFormat = format(Liii) ion presupuesto

Hoja5.Cells(ipoint, 14) = Deditarimporte 'importe de ejecuc

format(Liii))

Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bok1 = False End If '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy i5b = 0 iindice5 = 1 Scadena5 = "=" Bnoentro = False imarca5 = 0 Do While i5 <= Ipuntos + D_Proy If i5b <> 0 And i5b + 1 <> i5 Then Exit Do If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5,

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then e para espresar total mov de t

i5b = i5 imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) =

D_puntero = j + ipuntero + 1 ipuntero5 = j 'cuidado con esto (la j) que sirv Exit For End If Next j End If Bmarcasalto1 = True 'Bok = False Bok1 = False If Iajusta < 5 Then Iajusta = 5 'IFlagposition5 = 1 'If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then If Strings.Trim(Hoja4.Cells(i5, 3)) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & Strings.forma t(iindice5 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2

If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3)

Mdulo9 - 102 ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice5 = iindice5 + 1 Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssc" 'Selection.Font.Bold = True Bok = True Bnoentro = True ipoint = ipoint + 2 Dmedicion = CDbl(Hoja4.Cells(i5, 7 + Itipo_de_proyecto

Else * 3 + 1)) Li))

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Deditarimporte = Strings.format(Deditarimporte, format( Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Else

Then

Stemp2 = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & Strings.f ormat(iindice5 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo

Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero, 2) iindice5 = iindice5 + 1

Trim(Conversion.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena5 = Strings.Trim(Scadena5) + "+O" & Strings.

Hoja5.Cells(ipoint, 14).NumberFormat = format(Li) Hoja5.Cells(ipoint, 13).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 15).NumberFormat = format(Liii)

e ejecucion presupuesto

Hoja5.Cells(ipoint, 14) = Deditarimporte 'importe d

Liii) edicion, format(Liii))

Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion,

Deditarimporte = Strings.format(Deditarimporte * Dm

, 6)

Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_puntero ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bok = True End If TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy i6b = 0 iindice6 = 1 Scadena6 = "="

Mdulo9 - 103

lls(i6, 1) - TBase6) > 0)) Then

imarca6 = 0 Do While i6 <= Ipuntos + D_Proy If i6b <> 0 And i6b + 1 <> i6 Then Exit Do If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then que sirve para espresar total mov de t

i6b = i6 imarca6 = imarca6 + 1 'este no D_puntero = CDbl(Hoja4.Cells(i6, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + D_puntero = j + ipuntero + 1 ipuntero6 = j 'cuidado con esto (la j) Exit For End If Next j End If Bmarcasalto = True Bok = False If Iajusta < 6 Then Iajusta = 6 'IFlagposition6 = 1 If Strings.Trim(Hoja4.Cells(i6, 3)) = "C" Then 'If Hoja4.Cells(j + ipuntero + 1, 4) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strin gs.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & Strin gs.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_pun tero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_pun tero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_puntero , 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_puntero , 2) iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssssc" Bo = True Bnoentr = True 'Selection.Font.Bold = True ipoint = ipoint + 2

Else royecto * 3 + 1)) ) format(Li)) i)) Then te = 0) Then

Dmedicion = CDbl(Hoja4.Cells(i6, 7 + Itipo_de_p

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)

Deditarimporte = Strings.format(Deditarimporte,

Dmedicion = Strings.format(Dmedicion, format(Li

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0)

ElseIf (B_Pres_Solo_Con_Precio And Deditarimpor Else

Stemp2 = Strings.format(iindice1, "00") & S

Mdulo9 - 104

trings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & S trings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D_pun tero, 3) ' el resumen subcapitulo tero, 1) tero, 2)

Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D_pun

Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D_pun iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 1) = "p" Scadena6 = Strings.Trim(Scadena6) + "+O" &

Strings.Trim(Conversion.Str(ipoint)) at(Li) at(Lii) at(Liii) mporte de ejecucion presupuesto edicion, Liii) rte * Dmedicion, format(Liii))

Hoja5.Cells(ipoint, 14).NumberFormat = form

Hoja5.Cells(ipoint, 13).NumberFormat = form

Hoja5.Cells(ipoint, 15).NumberFormat = form

Hoja5.Cells(ipoint, 14) = Deditarimporte 'i

Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dm

Deditarimporte = Strings.format(Deditarimpo

Hoja5.Cells(ipoint, 15) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = Tru

_puntero, 6)

Hoja5.Cells(ipoint, 12).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4.Cells(D ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If Bo = True End If

****

'**************************************************

Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

TBase7 = (TBase6 + imarca6) * 100 i7 = 1 + D_Proy iindice7 = 1 Scadena7 = "=" 'imarca7 = 0 Do While i7 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And ((

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then o (la j) que sirve para espresar total mov de t

'imarca7 = imarca7 + 1 ' D_puntero = CDbl(Hoja4.Cells(i7, 4)) If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu

D_puntero = j + ipuntero + 1 'ipuntero7 = j 'cuidado con est

Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(j + ipunte

Mdulo9 - 105 ro + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then ' Exit For ' End If 'Next j Bmarcasalt = True Bo = False

hen

If Iajusta < 7 Then Iajusta = 7 'IFlagposition6 = 1 If Strings.Trim(Hoja4.Cells(i7, 3)) = "C" T 'If Hoja4.Cells(D_puntero, 4) = "C" Then

Stemp2 = Strings.format(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.format(iindice7 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stem p2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 12) = Hoja4.Cel ls(D_puntero, 6) Else Hoja5.Cells(ipoint, 12) = Hoja4.Cel ls(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 10) = Hoja4.Cells(D _puntero, 1) Hoja5.Cells(ipoint, 11) = Hoja4.Cells(D _puntero, 2) iindice7 = iindice7 + 1 e

Hoja5.Cells(ipoint, 12).Font.Bold = Tru Hoja5.Cells(ipoint, 1) = "ssssssc" 'B = True 'Bnoent = True 'Selection.Font.Bold = True ipoint = ipoint + 2

Else ipo_de_proyecto * 3 + 1)) tero, 5)) importe, format(Li)) ormat(Lii)) ion = 0) Then tarimporte = 0) Then

Dmedicion = CDbl(Hoja4.Cells(i7, 7 + It

Deditarimporte = CDbl(Hoja4.Cells(D_pun

Deditarimporte = Strings.format(Deditar

Dmedicion = Strings.format(Dmedicion, f

If (B_Pres_Solo_Con_Medicion And Dmedic

ElseIf (B_Pres_Solo_Con_Precio And Dedi Else

Stemp2 = Strings.format(iindice1, " 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice4, " 00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.format(iindice 7 + 1, "00") ipoint_temp = enlazarlinea(ipoint, Stemp2) If ipoint_temp <> 0 Then 'enlazarlinea ipoint, Stemp2 ipoint = ipoint_temp End If Hoja5.Cells(ipoint, 2) = Stemp2 Hoja5.Cells(ipoint, 12) = Hoja4.Cel ls(D_puntero, 3) ' el resumen subcapitulo

Hoja5.Cells(ipoint, 10) = Hoja4.Cel

Mdulo9 - 106 ls(D_puntero, 1) ls(D_puntero, 2)

Hoja5.Cells(ipoint, 11) = Hoja4.Cel iindice7 = iindice7 + 1

"+O" & Strings.Trim(Conversion.Str(ipoint)) t = format(Li) t = format(Lii) t = format(Liii) porte 'importe de ejecucion presupuesto rte * Dmedicion, Liii) itarimporte * Dmedicion, format(Liii)) porte en ld = True t = True .Cells(D_puntero, 6)

Hoja5.Cells(ipoint, 1) = "p" Scadena6 = Strings.Trim(Scadena7) +

Hoja5.Cells(ipoint, 14).NumberForma

Hoja5.Cells(ipoint, 13).NumberForma

Hoja5.Cells(ipoint, 15).NumberForma

Hoja5.Cells(ipoint, 14) = Deditarim

Hoja5.Cells(ipoint, 13) = Dmedicion 'Deditarimporte = Round(Deditarimpo

Deditarimporte = Strings.format(Ded

Hoja5.Cells(ipoint, 15) = Deditarim

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Th

'Hoja5.Cells(ipoint, 5).Font.Bo

Hoja5.Cells(ipoint, 12).WrapTex

Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 12) = Hoja4 ipoint = ipoint + 1 End If ipoint = ipoint + 1 End If 'B = True End If End If 'cuidado por aqui i7 = i7 + 1

Loop

Trim(Conversion.Str(ipoint)) puntero3 + ipuntero + 1, 3)

''hasta aqui End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True Hoja5.Cells(ipoint, 1) = "tsssssc" Scadena6 = Strings.Trim(Scadena6) + "+O" & Strings.

'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(i

e = xlContinuous tyle = xlContinuous

Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select If Scadena7 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena7 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyl

Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineS ipoint = ipoint + 2

Mdulo9 - 107

puntero3 + ipuntero + 1, 3)

ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tsssssc" 'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(i Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0"

e = xlContinuous tyle = xlContinuous

'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True 'Hoja5.Rows(ipoint).Font.Bold = True 'Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyl

Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineS ipoint = ipoint + 2 End If i6 = i6 + 1 Bnoentr = False

Loop

version.Str(ipoint)) + ipuntero + 1, 3)

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True Hoja5.Cells(ipoint, 1) = "tssssc" Scadena5 = Strings.Trim(Scadena5) + "+O" & Strings.Trim(Con

'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(ipuntero3

ntinuous lContinuous

Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select If Scadena6 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena6 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlCo

Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = x

+ ipuntero + 1, 3)

ipoint = ipoint + 2 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tssssc" 'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(ipuntero3 Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True 'Hoja5.Rows(ipoint).Font.Bold = True 'Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True

Mdulo9 - 108 ntinuous lContinuous

Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlCo

Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = x ipoint = ipoint + 2 End If i5 = i5 + 1 Bnoentro = False Loop

Str(ipoint)) ero + 1, 3)

End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True 'no estaba_creo que era un error Hoja5.Cells(ipoint, 1) = "tsssc" Scadena4 = Strings.Trim(Scadena4) + "+O" & Strings.Trim(Conversion.

'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipunt

ous

Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select If Scadena5 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena5 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinu ipoint = ipoint + 2

ero + 1, 3)

ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False Hoja5.Cells(ipoint, 1) = "tsssc" 'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipunt

ous

Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinu ipoint = ipoint + 2 '******************************************************** End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

nt))

End If If Bmarcasalto2 = True Then 'Bmarcasalto = False Bmarcasalto2 = False Bnoentro2 = True 'Bnoentro = True 'Bok = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tssc" Scadena3 = Strings.Trim(Scadena3) + "+O" & Strings.Trim(Conversion.Str(ipoi

Mdulo9 - 109 3)

'Hoja5.Cells(ipoint, 12) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, Hoja5.Cells(ipoint, 12) = "Total Cap. " 'Hoja5.Cells(ipoint, 12).Select If Scadena4 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena4 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tssc" Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 15).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 End If i3 = i3 + 1 Bnoentro2 = False

Loop

End If If Bmarcasalto3 = True Then 'Bmarcasalto1 = False Bmarcasalto3 = False 'Bnoentro1 = True Bnoentro3 = True Bok3 = True 'no estaba, creo que es un error Hoja5.Cells(ipoint, 1) = "tsc" Scadena2 = Strings.Trim(Scadena2) + "+O" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select If Scadena3 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena3 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False Hoja5.Cells(ipoint, 1) = "tsc" Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True

Mdulo9 - 110 Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 2 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then 'Bmarcasalto2 = False Bmarcasalto4 = False 'Bnoentro2 = True Bnoentro4 = True 'Bok2 = True Bok4 = True Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+O" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select If Scadena2 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena2 End If 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False Hoja5.Cells(ipoint, 1) = "tc" Hoja5.Cells(ipoint, 12) = "Total Cap." 'Hoja5.Cells(ipoint, 12).Select Hoja5.Cells(ipoint, 15).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True Hoja5.Cells(ipoint, 15).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 15).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 2 End If i1 = i1 + 1 Bnoentro4 = False 12).Font.Bold = True 15).Font.Bold = True 15).Borders(xlEdgeTop).LineStyle = xlContinuous 15).Borders(xlEdgeBottom).LineStyle = xlContinuous

Loop

Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 12) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 15).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 15).FormulaLocal = Scadena1 End If Hoja5.Cells(ipoint, 15).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 12).Font.Bold = True Hoja5.Cells(ipoint, 15).Font.Bold = True 'With Selection.Borders(xlEdgeTop) ' .LineStyle = xlContinuous ' .Weight = xlMedium ' .ColorIndex = xlAutomatic

Mdulo9 - 111 'End With

End Sub Public Sub pres_presupuesto_presto(ByVal Li As Integer, ByVal Lii As Integer, ByVal Liii As Integer ) Dim i As Double, j As Double Dim ipoint As Double Dim i1, i2, i3, i4, i5, i6, i7 As Double Dim imarca1, imarca2, imarca3, imarca4, imarca5, imarca6 As Double Dim iindice1, iindice2, iindice3, iindice4, iindice5, iindice6, iindice7 As Integer Dim TBase2, TBase3, TBase4, TBase5, TBase6, TBase7 As Double Dim Iajusta As Integer Dim Stemp As String Dim Bmarcasalto, Bmarcasalto1, Bmarcasalto2, Bmarcasalto3, Bmarcasalto4, Bmarcasalt As Boolean Dim Bnoentro, Bnoentro1, Bnoentro2, Bnoentro3, Bnoentro4, Bnoentr As Double Dim Bok, Bok1, Bok2, Bok3, Bok4, Bo As Double Dim ipuntero1, ipuntero2, ipuntero3, ipuntero4, ipuntero5, ipuntero6, ipuntero7 As Integer Dim Scadena1, Scadena2, Scadena3, Scadena4, Scadena5, Scadena6, Scadena7 As String Dim coefprod As Double Dim NextCell As Range Dim CurrentCell As Range Dim Deditarimporte As Double Dim Dmedicion As Double Dim format(0 To 4) As String Dim Marca_puntero(0 To 6) As Double Dim D_puntero As Double Hoja4.Activate ipuntero = Hoja7.Range("B23") posicionconcepto = ipuntero + 2 Set NextCell = Hoja4.Cells(posicionconcepto, 1) NextCell.Select IConceptos = ActiveCell.CurrentRegion.Rows.Count - 1 Set NextCell = Hoja4.Cells(D_Proy + 1, 1) NextCell.Select If IsEmpty(NextCell.Value) Then Ipuntos = 0 Else Ipuntos = ActiveCell.CurrentRegion.Rows.Count 'j = 0 End If format(0) format(1) format(2) format(3) format(4) = = = = = "#,###,###,###,##0" "#,###,###,###,##0.0" "#,###,###,###,##0.00" "#,###,###,###,##0.000" "#,###,###,###,##0.0000"

Iajusta = 0 ipoint = 5 iindice1 = 0 imarca1 = 0 coefprod = CDbl(Hoja7.Cells(34, 4)) Scadena1 Scadena2 Scadena3 Scadena4 Scadena5 Scadena6 = = = = = = "=" "=" "=" "=" "=" "="

Bnoentro = True Bnoentro1 = True Bnoentro2 = True Bnoentro3 = True 'nuevo Bnoentro4 = True 'nuevo Bmarcasalto = False Bmarcasalto1 = False

Mdulo9 - 112 Bmarcasalto2 = False Bmarcasalto3 = False 'nuevo Bmarcasalto4 = False 'nuevo Hoja5.Activate Columns("A:A").ColumnWidth = 2 Columns("B:B").ColumnWidth = 10 Columns("D:D").ColumnWidth = 4 Columns("E:E").ColumnWidth = 20 Columns("F:H").ColumnWidth = 10 Columns("B:B").EntireColumn.NumberFormat = "@" Columns("B:B").HorizontalAlignment = xlLeft Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, ipoint = ipoint + 1 Bnoentro4 = False 'Bnoentro2 = False i1 = 1 + D_Proy Do While i1 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i1, 1)) And (Hoja4.Cells(i1, 1)) > 0) Then imarca1 = imarca1 + 1 D_puntero = CDbl(Hoja4.Cells(i1, 4)) 1) 2) 3) 4) 5) 6) 7) 8) = = = = = = = = "Des" 'Descriptor "numero" "Cdigo" "UM" "Resumen" "Precio" "Medicin" "Importe"

) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i1, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2)

)) Then

D_puntero = j + ipuntero + 1 ipuntero1 = j Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i1, 2 ' ipuntero1 = j ' Exit For ' End If 'Next j If Iajusta < 1 Then Iajusta = 1 'IFlagposition1 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(0) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format((iindice1 + 1), "00") iindice1 = iindice1 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "c" Hoja5.Cells(ipoint, 2).Select 'With Selection.Interior ' .ColorIndex = 37 ' .Pattern = xlSolid ' .PatternColorIndex = xlAutomatic 'End With Hoja5.Rows(ipoint).Interior.ColorIndex = 33

Mdulo9 - 113 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutomatic 'Bok2 = True Bok4 = True 'Bnoentro2 = True Bnoentro4 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i1, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, iindice1 = iindice1 3) = Hoja4.Cells(D_puntero, 1) 4) = Hoja4.Cells(D_puntero, 2) 2) = Strings.format((iindice1 + 1), "00") + 1 "+H" & Strings.Trim(Conversion.Str(ipoint)) = format(Li) = format(Lii) = format(Liii) 'importe de ejecucion presupuesto

Else

Hoja5.Cells(ipoint, 1) = "p" Scadena1 = Strings.Trim(Scadena1) + Hoja5.Cells(ipoint, 6).NumberFormat Hoja5.Cells(ipoint, 7).NumberFormat Hoja5.Cells(ipoint, 8).NumberFormat

Hoja5.Cells(ipoint, 6) = Deditarimporte

Hoja5.Cells(ipoint, 7) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) 'Hoja5.Cells(ipoint, 13).FormulaLocal = "=K" & Strings.Trim(Conversion.Str(ipoint)) & "*L" & Strings.Trim(Conversion.Str(ipoint)) Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok4 = False 'Bok2 = False End If 'ipoint = ipoint + 1 TBase2 = imarca1 * 100 imarca2 = 0 iindice2 = 0 i2 = 1 + D_Proy Scadena2 = "=" 'Bnoentro1 = False Bnoentro3 = False Do While i2 <= Ipuntos + D_Proy If (99 > (Hoja4.Cells(i2, 1) - TBase2)) And ((Hoja4.Cells(i2, 1) - TBase2)) > 0 Then imarca2 = imarca2 + 1 D_puntero = CDbl(Hoja4.Cells(i2, 4))

s(i2, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i2, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Hoja4.Cell D_puntero = j + ipuntero + 1 ipuntero2 = j Exit For End If Next j End If 'For j = 1 To IConceptos

Mdulo9 - 114 2)) Then ' If Strings.Trim(Hoja4.Cells(D_puntero, 1)) = Strings.Trim(Hoja4.Cells(i2,

' ipuntero2 = j ' Exit For ' End If 'Next j Bmarcasalto4 = True Bok4 = False

e2 + 1, "00")

If Iajusta < 2 Then Iajusta = 2 'IFlagposition2 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(1) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.format(iindic iindice2 = iindice2 + 1 Hoja5.Cells(ipoint, 1) = "sc" Hoja5.Cells(ipoint, 5).Font.Bold = True 'Hoja5.Rows(ipoint).Interior.ColorIndex = 37 'Hoja5.Rows(ipoint).Interior.Pattern = xlSolid 'Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutomatic 'Range("C14").Select 'Hoja5.Cells(ipoint, 2).Select 'With Selection.Interior ' .ColorIndex = 37 ' .Pattern = xlSolid ' .PatternColorIndex = xlAutomatic 'End With Hoja5.Rows(ipoint).Interior.ColorIndex = 37 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutomatic 'Selection.Font.Bold = True 'Bok1 = True Bok3 = True 'Bnoentro1 = True Bnoentro3 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i2, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, Hoja5.Cells(ipoint, 5) 3) 4) 2) = = = =

Else

ndice2 + 1, "00")

Hoja4.Cells(D_puntero, 3) ' el resumen subcapitulo Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strings.format(ii

iindice2 = iindice2 + 1

nt))

Hoja5.Cells(ipoint, 1) = "p" Scadena2 = Strings.Trim(Scadena2) + "+H" & Strings.Trim(Conversion.Str(ipoi Hoja5.Cells(ipoint, 6).NumberFormat = format(Li) Hoja5.Cells(ipoint, 7).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii) 'Deditarimporte = Round(CDbl(Hoja4.Cells(D_puntero, 5)), Li) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format(Liii)) Hoja5.Cells(ipoint, 6) = Deditarimporte 'importe de ejecucion presupuesto Hoja5.Cells(ipoint, 7) = Dmedicion

Mdulo9 - 115 Hoja5.Cells(ipoint, 8) = Deditarimporte

)) Then

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok3 = False 'Bok1 = False End If 'ipoint = ipoint + 1 TBase3 = (TBase2 + imarca2) * 100 imarca3 = 0 i3 = 1 + D_Proy iindice3 = 0 Scadena3 = "=" Bnoentro2 = False Do While i3 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i3, 1) - TBase3)) And ((Hoja4.Cells(i3, 1) - TBase3) > 0 imarca3 = imarca3 + 1 D_puntero = CDbl(Hoja4.Cells(i3, 4))

ja4.Cells(i3, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i3, 2)) Then For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings.Trim(Ho

i3, 2)) Then

D_puntero = j + ipuntero + 1 ipuntero3 = j Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(D_puntero, 1)) = Strings.Trim(Hoja4.Cells(

capitulo

' ipuntero3 = j ' Exit For ' End If 'Next j Bmarcasalto3 = True Bok3 = False 'Bok1 = False 'Hoja5.Cells(ipoint, 5) = Hoja4.Cells(j + ipuntero + 1, 6) ' el resumen sub

capitulo

If Iajusta < 3 Then Iajusta = 3 'IFlagposition3 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(2) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen sub

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.forma t(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1 Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssc" Hoja5.Rows(ipoint).Interior.ColorIndex = 43 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutomatic 'Selection.Font.Bold = True 'Bok = True Bok2 = True 'Bnoentro = True

Mdulo9 - 116 Bnoentro2 = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i3, 7 + Itipo_de_proyecto * 3 + 1)) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else capitulo

Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el resumen sub

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero, 1) Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero, 2) Hoja5.Cells(ipoint, 2) = Strings.format(iindice1, "00") & Strings.f ormat(iindice2, "00") & Strings.format(iindice3 + 1, "00") iindice3 = iindice3 + 1

Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena3 = Strings.Trim(Scadena3) + "+H" & Strings.Trim(Conversion. Hoja5.Cells(ipoint, 6).NumberFormat = format(Li) Hoja5.Cells(ipoint, 7).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

puesto

Hoja5.Cells(ipoint, 6) = Deditarimporte 'importe de ejecucion presu

Liii))

Hoja5.Cells(ipoint, 7) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, format( Hoja5.Cells(ipoint, 8) = Deditarimporte

se4) > 0)) Then

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok2 = False 'Bok = False End If 'ipoint = ipoint + 1 TBase4 = (TBase3 + imarca3) * 100 i4 = 1 + D_Proy iindice4 = 1 Scadena4 = "=" imarca4 = 0 Bnoentro1 = False Do While i4 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i4, 1) - TBase4)) And ((Hoja4.Cells(i4, 1) - TBa imarca4 = imarca4 + 1 D_puntero = CDbl(Hoja4.Cells(i4, 4))

en .Trim(Hoja4.Cells(i4, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i4, 2)) Th

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) = Strings D_puntero = j + ipuntero + 1 ipuntero4 = j Exit For End If Next j End If 'For j = 1 To IConceptos

Mdulo9 - 117 4.Cells(i4, 2)) Then '

If Strings.Trim(Hoja4.Cells(D_puntero, 1)) = Strings.Trim(Hoja

' ipuntero4 = j ' Exit For ' End If 'Next j Bmarcasalto2 = True 'Bok = False Bok2 = False

umen subcapitulo

If Iajusta < 4 Then Iajusta = 4 'IFlagposition4 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(3) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

End If Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = gs.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & Strin Strings.format(iindice4 + 1, "00")

Else )

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssc" Hoja5.Rows(ipoint).Interior.ColorIndex = 48 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutomatic 'Selection.Font.Bold = True Bok1 = True Bnoentro1 = True ipoint = ipoint + 1

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i4, 7 + Itipo_de_proyecto * 3 + 1) Deditarimporte = Strings.format(Deditarimporte, format(Li)) Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Then Else

umen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3) ' el res

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = trings.format(iindice2, "00") & Strings.format(iindice3, "00") & iindice4 = iindice4 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") & S Strings.format(iindice4 + 1, "00")

version.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena4 = Strings.Trim(Scadena4) + "+H" & Strings.Trim(Con Hoja5.Cells(ipoint, 6).NumberFormat = format(Li) Hoja5.Cells(ipoint, 7).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

on presupuesto

Hoja5.Cells(ipoint, 6) = Deditarimporte 'importe de ejecuci

format(Liii))

Hoja5.Cells(ipoint, 7) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion, Liii) Deditarimporte = Strings.format(Deditarimporte * Dmedicion, Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True

Mdulo9 - 118 Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) ipoint = ipoint + 1 End If End If Bok1 = False End If 'ipoint = ipoint + 1 '******************************************************** '****** TBase5 = (TBase4 + imarca4) * 100 i5 = 1 + D_Proy iindice5 = 1 Scadena5 = "=" Bnoentro = False imarca5 = 0 Do While i5 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i5, 1) - TBase5)) And ((Hoja4.Cells(i5, imarca5 = imarca5 + 1 D_puntero = CDbl(Hoja4.Cells(i5, 4))

1) - TBase5) > 0)) Then

, 2)) Then Strings.Trim(Hoja4.Cells(i5, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4.Cells(i5

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero + 1, 1)) =

rim(Hoja4.Cells(i5, 2)) Then

D_puntero = j + ipuntero + 1 ipuntero5 = j Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(D_puntero, 1)) = Strings.T ' ipuntero5 = j ' Exit For ' End If 'Next j Bmarcasalto1 = True Bok1 = False If Iajusta < 5 Then Iajusta = 5 'IFlagposition5 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(4) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 6) Else Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

' el resumen subcapitulo

End If Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, "00") Strings.format(iindice4, "00")

atic

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssc" Hoja5.Rows(ipoint).Interior.ColorIndex = 47 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = xlAutom 'Selection.Font.Bold = True Bok = True Bnoentro = True ipoint = ipoint + 1 Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)) Dmedicion = CDbl(Hoja4.Cells(i5, 7 + Itipo_de_proyecto

Else * 3 + 1))

Mdulo9 - 119

Li))

Deditarimporte = Strings.format(Deditarimporte, format( Dmedicion = Strings.format(Dmedicion, format(Lii)) If (B_Pres_Solo_Con_Medicion And Dmedicion = 0) Then

Then

ElseIf (B_Pres_Solo_Con_Precio And Deditarimporte = 0) Else

' el resumen subcapitulo

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero, 3)

Hoja5.Cells(ipoint, 3) = Hoja5.Cells(ipoint, 4) = Hoja5.Cells(ipoint, 2) = 00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & 00") & Strings.format(iindice5 + 1, "00") iindice5 = iindice5 + 1

Hoja4.Cells(D_puntero, 1) Hoja4.Cells(D_puntero, 2) Strings.format(iindice1, " Strings.format(iindice4, "

Trim(Conversion.Str(ipoint))

Hoja5.Cells(ipoint, 1) = "p" Scadena5 = Strings.Trim(Scadena5) + "+H" & Strings. Hoja5.Cells(ipoint, 6).NumberFormat = format(Li) Hoja5.Cells(ipoint, 7).NumberFormat = format(Lii) Hoja5.Cells(ipoint, 8).NumberFormat = format(Liii)

ejecucion presupuesto

Hoja5.Cells(ipoint, 6) = Deditarimporte 'importe de

Liii) edicion, format(Liii))

Hoja5.Cells(ipoint, 7) = Dmedicion 'Deditarimporte = Round(Deditarimporte * Dmedicion,

Deditarimporte = Strings.format(Deditarimporte * Dm Hoja5.Cells(ipoint, 8) = Deditarimporte

6)

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_puntero,

lls(i6, 1) - TBase6) > 0)) Then

ipoint = ipoint + 1 End If End If Bok = True End If 'ipoint = ipoint + 1 TBase6 = (TBase5 + imarca5) * 100 i6 = 1 + D_Proy iindice6 = 1 Scadena6 = "=" imarca6 = 0 Do While i6 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i6, 1) - TBase6)) And ((Hoja4.Ce imarca6 = imarca6 + 1 D_puntero = CDbl(Hoja4.Cells(i6, 4))

Cells(i6, 2)) Then 1, 1)) = Strings.Trim(Hoja4.Cells(i6, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Trim(Hoja4. For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipuntero +

D_puntero = j + ipuntero + 1 ipuntero6 = j Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(D_puntero, 1)) = S

Mdulo9 - 120 trings.Trim(Hoja4.Cells(i6, 2)) Then ' ipuntero6 = j ' Exit For ' End If 'Next j Bmarcasalto = True Bok = False

ero, 6) ero, 3) ' el resumen subcapitulo 1) 2)

If Iajusta < 6 Then Iajusta = 6 'IFlagposition6 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(5) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_puntero,

Hoja5.Cells(ipoint, 2) = Strings.format(iindice 1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iindice 4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1

xlAutomatic

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "sssssc" Hoja5.Rows(ipoint).Interior.ColorIndex = 50 Hoja5.Rows(ipoint).Interior.Pattern = xlSolid Hoja5.Rows(ipoint).Interior.PatternColorIndex = 'Selection.Font.Bold = True Bo = True 'no Bnoentr = True 'no ipoint = ipoint + 1

Else ) royecto * 3 + 1)) format(Li)) i)) Then te = 0) Then

Deditarimporte = CDbl(Hoja4.Cells(D_puntero, 5)

Dmedicion = CDbl(Hoja4.Cells(i6, 7 + Itipo_de_p

Deditarimporte = Strings.format(Deditarimporte,

Dmedicion = Strings.format(Dmedicion, format(Li

If (B_Pres_Solo_Con_Medicion And Dmedicion = 0)

ElseIf (B_Pres_Solo_Con_Precio And Deditarimpor Else

ero, 3) ' el resumen subcapitulo ero, 1) ero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_punt

Hoja5.Cells(ipoint, 2) = Strings.format(iin dice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format(iin dice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") iindice6 = iindice6 + 1 Hoja5.Cells(ipoint, 1) = "p" Scadena6 = Strings.Trim(Scadena6) + "+H" &

Strings.Trim(Conversion.Str(ipoint)) t(Li) t(Lii)

Hoja5.Cells(ipoint, 6).NumberFormat = forma

Hoja5.Cells(ipoint, 7).NumberFormat = forma

Hoja5.Cells(ipoint, 8).NumberFormat = forma

Mdulo9 - 121 t(Liii) porte de ejecucion presupuesto

Hoja5.Cells(ipoint, 6) = Deditarimporte 'im Hoja5.Cells(ipoint, 7) = Dmedicion

edicion, Liii) rte * Dmedicion, format(Liii))

'Deditarimporte = Round(Deditarimporte * Dm

Deditarimporte = Strings.format(Deditarimpo

Hoja5.Cells(ipoint, 8) = Deditarimporte ipoint = ipoint + 1 If B_Solo_texto_resumido = False Then 'Hoja5.Cells(ipoint, 5).Font.Bold = Tru

puntero, 6)

Hoja5.Cells(ipoint, 5).WrapText = True Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4.Cells(D_

****

ipoint = ipoint + 1 End If End If Bo = True 'no End If 'ipoint = ipoint + 1 '**************************************************

Hoja4.Cells(i7, 1) - TBase7) > 0)) Then

TBase7 = (TBase6 + imarca6) * 100 i7 = 1 + D_Proy iindice7 = 1 Scadena7 = "=" 'imarca7 = 0 Do While i7 <= Ipuntos + D_Proy If ((99 > (Hoja4.Cells(i7, 1) - TBase7)) And (( 'imarca7 = imarca7 + 1 D_puntero = CDbl(Hoja4.Cells(i7, 4))

m(Hoja4.Cells(i7, 2)) Then ntero + 1, 1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

If Hoja4.Cells(D_puntero, 1) <> Strings.Tri

For j = 1 To IConceptos If Strings.Trim(Hoja4.Cells(j + ipu

1)) = Strings.Trim(Hoja4.Cells(i7, 2)) Then

D_puntero = j + ipuntero + 1 ipuntero7 = j Exit For End If Next j End If 'For j = 1 To IConceptos ' If Strings.Trim(Hoja4.Cells(D_puntero, ' ipuntero7 = j ' Exit For ' End If 'Next j Bmarcasalt = True Bo = False

s(D_puntero, 6) s(D_puntero, 3) ' el resumen subcapitulo puntero, 1)

If Iajusta < 7 Then Iajusta = 7 'IFlagposition6 = 1 If Hoja4.Cells(D_puntero, 4) = "C" Then Marca_puntero(6) = ipoint If Hoja4.Cells(D_puntero, 6) <> "" Then Hoja5.Cells(ipoint, 5) = Hoja4.Cell Else

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

End If Hoja5.Cells(ipoint, 3) = Hoja4.Cells(D_

Hoja5.Cells(ipoint, 4) = Hoja4.Cells(D_

Mdulo9 - 122 puntero, 2)

Hoja5.Cells(ipoint, 2) = Strings.format (iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.format (iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & Strings.fo rmat(iindice7 + 1, "00") iindice7 = iindice7 + 1

Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 1) = "ssssssc" 'Selection.Font.Bold = True Else ipo_de_proyecto * 3 + 1)) tero, 5)) importe, format(Li)) ormat(Lii)) ion = 0) Then tarimporte = 0) Then ipoint = ipoint + 1

Dmedicion = CDbl(Hoja4.Cells(i7, 7 + It

Deditarimporte = CDbl(Hoja4.Cells(D_pun

Deditarimporte = Strings.format(Deditar

Dmedicion = Strings.format(Dmedicion, f

If (B_Pres_Solo_Con_Medicion And Dmedic

ElseIf (B_Pres_Solo_Con_Precio And Dedi Else

s(D_puntero, 3) ' el resumen subcapitulo s(D_puntero, 1) s(D_puntero, 2)

Hoja5.Cells(ipoint, 5) = Hoja4.Cell

Hoja5.Cells(ipoint, 3) = Hoja4.Cell

Hoja5.Cells(ipoint, 4) = Hoja4.Cell

Hoja5.Cells(ipoint, 2) = Strings.fo rmat(iindice1, "00") & Strings.format(iindice2, "00") & Strings.format(iindice3, "00") & Strings.fo rmat(iindice4, "00") & Strings.format(iindice5, "00") & Strings.format(iindice6 + 1, "00") & String s.format(iindice7 + 1, "00") iindice7 = iindice7 + 1

"+H" & Strings.Trim(Conversion.Str(ipoint)) = format(Li) = format(Lii) = format(Liii) orte 'importe de ejecucion presupuesto

Hoja5.Cells(ipoint, 1) = "p" Scadena7 = Strings.Trim(Scadena7) +

Hoja5.Cells(ipoint, 6).NumberFormat

Hoja5.Cells(ipoint, 7).NumberFormat

Hoja5.Cells(ipoint, 8).NumberFormat

Hoja5.Cells(ipoint, 6) = Deditarimp

rte * Dmedicion, Liii) itarimporte * Dmedicion, format(Liii)) orte en ld = True = True Cells(D_puntero, 6)

Hoja5.Cells(ipoint, 7) = Dmedicion 'Deditarimporte = Round(Deditarimpo

Deditarimporte = Strings.format(Ded

Hoja5.Cells(ipoint, 8) = Deditarimp

ipoint = ipoint + 1 If B_Solo_texto_resumido = False Th

'Hoja5.Cells(ipoint, 5).Font.Bo

Hoja5.Cells(ipoint, 5).WrapText

Hoja5.Cells(ipoint, 1) = "tl" Hoja5.Cells(ipoint, 5) = Hoja4. ipoint = ipoint + 1 End If End If

Mdulo9 - 123 End If 'ipoint = ipoint + 1 End If i7 = i7 + 1

Loop

Trim(Conversion.Str(ipoint)) untero3 + ipuntero + 1, 3)

End If If Bmarcasalt = True Then Bmarcasalt = False Bnoentr = True 'puede dar problemas Bo = True Hoja5.Cells(ipoint, 1) = "tsssssc" Scadena6 = Strings.Trim(Scadena6) + "+H" & Strings.

'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ip

"0"

Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select If Scadena7 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(5), 8).FormulaLocal = Else

Scadena7

Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena7 Hoja5.Cells(Marca_puntero(5), 8).FormulaLocal =

= xlContinuous yle = xlContinuous

End If 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineSt

untero3 + ipuntero + 1, 3)

ipoint = ipoint + 1 ElseIf Bo = True And Bnoentr = True Then Bnoentr = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tsssssc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ip

= xlContinuous yle = xlContinuous

Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(5), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True 'Hoja5.Rows(ipoint).Font.Bold = True 'Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineSt ipoint = ipoint + 1 End If i6 = i6 + 1 Bnoentr = False

Loop

End If '* If Bmarcasalto = True Then Bmarcasalto = False Bnoentro = True 'puede dar problemas Bok = True Hoja5.Cells(ipoint, 1) = "tssssc"

Mdulo9 - 124 version.Str(ipoint)) + ipuntero + 1, 3)

Scadena5 = Strings.Trim(Scadena5) + "+H" & Strings.Trim(Con 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3

Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select If Scadena6 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(4), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena6 Hoja5.Cells(Marca_puntero(4), 8).FormulaLocal = Scadena

tinuous Continuous

End If 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlCon

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xl ipoint = ipoint + 1 ElseIf Bok = True And Bnoentro = True Then Bnoentro = False 'puede dar problemas Hoja5.Cells(ipoint, 1) = "tssssc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3

+ ipuntero + 1, 3)

tinuous Continuous

Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(4), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True 'Hoja5.Rows(ipoint).Font.Bold = True 'Hoja5.Cells(ipoint, 9) = "Total ..." Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlCon

Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xl ipoint = ipoint + 1 End If i5 = i5 + 1 Bnoentro = False Loop

Str(ipoint)) ro + 1, 3)

End If If Bmarcasalto1 = True Then Bmarcasalto1 = False Bnoentro1 = True Bok1 = True 'no estaba_creo que era un error Hoja5.Cells(ipoint, 1) = "tsssc" Scadena4 = Strings.Trim(Scadena4) + "+H" & Strings.Trim(Conversion.

'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipunte Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select If Scadena5 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(3), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena5 Hoja5.Cells(Marca_puntero(3), 8).FormulaLocal = Scadena5 End If 'Hoja5.Cells(ipoint, 8).Select

Mdulo9 - 125

us

'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuo ipoint = ipoint + 1

ro + 1, 3)

ElseIf Bok1 = True And Bnoentro1 = True Then Bnoentro1 = False Hoja5.Cells(ipoint, 1) = "tsssc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipunte

us

Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(3), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuo ipoint = ipoint + 1 '******************************************************** End If i4 = i4 + 1 Bnoentro1 = False 'nuevo

Loop

nt)) 3)

End If If Bmarcasalto2 = True Then 'Bmarcasalto = False Bmarcasalto2 = False Bnoentro2 = True 'Bnoentro = True 'Bok = True Bok2 = True Hoja5.Cells(ipoint, 1) = "tssc" Scadena3 = Strings.Trim(Scadena3) + "+H" & Strings.Trim(Conversion.Str(ipoi 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, Hoja5.Cells(ipoint, 5) = "Total Cap. " 'Hoja5.Cells(ipoint, 5).Select If Scadena4 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(2), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena4 Hoja5.Cells(Marca_puntero(2), 8).FormulaLocal = Scadena4 End If 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 ElseIf Bok2 = True And Bnoentro2 = True Then Bnoentro2 = False Hoja5.Cells(ipoint, 1) = "tssc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero3 + ipuntero + 1, Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0"

3)

Mdulo9 - 126 Hoja5.Cells(Marca_puntero(2), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.Copy 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 End If i3 = i3 + 1 Bnoentro2 = False

Loop

End If If Bmarcasalto3 = True Then 'Bmarcasalto1 = False Bmarcasalto3 = False 'Bnoentro1 = True Bnoentro3 = True Bok3 = True 'no estaba, creo que es un error Hoja5.Cells(ipoint, 1) = "tsc" Scadena2 = Strings.Trim(Scadena2) + "+H" & Strings.Trim(Conversion.Str(ipoint)) 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select If Scadena3 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(1), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena3 Hoja5.Cells(Marca_puntero(1), 8).FormulaLocal = Scadena3 End If 'Hoja5.Cells(ipoint, 8).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 ElseIf Bok3 = True And Bnoentro3 = True Then Bnoentro3 = False Hoja5.Cells(ipoint, 1) = "tsc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero2 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(1), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 End If Bnoentro3 = False i2 = i2 + 1 Loop End If If Bmarcasalto4 = True Then 'Bmarcasalto2 = False Bmarcasalto4 = False 'Bnoentro2 = True Bnoentro4 = True 'Bok2 = True Bok4 = True

Mdulo9 - 127 Hoja5.Cells(ipoint, 1) = "tc" Scadena1 = Strings.Trim(Scadena1) + "+H" & Strings.Trim(Conversion.Str(ipoint)) 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select If Scadena2 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(0), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena2 Hoja5.Cells(Marca_puntero(0), 8).FormulaLocal = Scadena2 End If 'Hoja5.Cells(ipoint, 8).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 ElseIf Bok4 = True And Bnoentro4 = True Then Bnoentro4 = False Hoja5.Cells(ipoint, 1) = "tc" 'Hoja5.Cells(ipoint, 5) = "TOTAL " & Hoja4.Cells(ipuntero1 + ipuntero + 1, 3) Hoja5.Cells(ipoint, 5) = "Total Cap." 'Hoja5.Cells(ipoint, 5).Select Hoja5.Cells(ipoint, 8).FormulaLocal = "0" Hoja5.Cells(Marca_puntero(0), 8).FormulaLocal = "0" 'Hoja5.Cells(ipoint, 8).Select 'Selection.EntireRow.Select 'Selection.Font.Bold = True Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True Hoja5.Cells(ipoint, 8).Borders(xlEdgeTop).LineStyle = xlContinuous Hoja5.Cells(ipoint, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous ipoint = ipoint + 1 End If i1 = i1 + 1 Bnoentro4 = False

Loop

Hoja5.Cells(ipoint, 1) = "f" Hoja5.Cells(ipoint, 5) = "TOTAL OBRA " If Scadena1 = "=" Then Hoja5.Cells(ipoint, 8).FormulaLocal = "0" 'Hoja5.Cells(Marca_puntero(0), 8).FormulaLocal = "0" Else Hoja5.Cells(ipoint, 8).FormulaLocal = Scadena1 'Hoja5.Cells(Marca_puntero(0), 8).FormulaLocal = Scadena1 End If 'Hoja5.Cells(ipoint, 8).Select Hoja5.Cells(ipoint, 5).Font.Bold = True Hoja5.Cells(ipoint, 8).Font.Bold = True 'Selection.EntireRow.Select 'Selection.Font.Bold = True 'With Selection.Borders(xlEdgeTop) ' .LineStyle = xlContinuous ' .Weight = xlMedium ' .ColorIndex = xlAutomatic 'End With End Sub

NumeroaLetra - 1

Option Explicit Option Compare Text ' 01/04/2008 ltimas modificaciones ' Paco Mega, octubre 2003-agosto 2006 ' http://www.necesitomas.com ' Para cualquier comentario: excel@necesitomas.com ' ' Basado en algunas cosas que me baj de internet, (Guillermo Som, 1991-97. Tambin de PCworld Clau dio H. Snchez 2002) ' Patrocinado por http://www.geoconsult.es Public Function NumLetra(Nmero As Double, Optional NumDecimales As Integer, _ Optional Unidad As String, Optional UdFracc As String, _ Optional Conexin As String, Optional Cero As Boolean, _ Optional UD_un_uno_a As Integer, Optional Frac_un_uno_a As Integer) As String ' funcin para convertir nmeros a letra. ' se emplea un nmero tipo double, 8 bytes ' (Mximo NMEROS DE 15 DGITOS, a partir de ah son nmeros en coma flotante, ' y deberan introducirse como texto para poder mantener todas las cifras)

' Nmero el nmero a convertir, OBLIGATORIO ' NumDecimales nmero de decimales a considerar para pasar a texto (por defecto: cero) ' Si el nmero de decimales es negativo, se redondea el nmero segn lo indicado ' Unidad nombre de la unidad principal, se pondr detrs de la parte entera ' UdFracc nombre de la unidad fraccionaria, se pondr detrs de los decimales ' Conexin texto que separar la parte entera de la decimal(por ejemplo, tres euros "CON" quince c ntimos) ' Cero verdadero 0->"cero" falso 0->"" (por defecto: falso) ' UD_un_uno_a para la unidad principal 1: 1->"un" 2: 1->"uno" 3: 1->"una" (por defecto: 1) ' Fracc_un_uno_a para la unidad principal 1: 1->"un" 2: 1->"uno" 3: 1->"una" (por defecto: 1) 'Valores por defecto: If IsMissing(NumDecimales) Then NumDecimales = 0 If IsMissing(Unidad) Then Unidad = "" If IsMissing(UdFracc) Then UdFracc = "" If IsMissing(Conexin) Then Conexin = "" If IsMissing(Cero) Then Cero = False If UD_un_uno_a = 0 Then UD_un_uno_a = 1 If Frac_un_uno_a = 0 Then Frac_un_uno_a = 1 Dim intSigno As Integer Dim dblNmero As Double ' signo del nmero ' nmero a transformar, en positivo

Dim intParteEntera As Double Dim intParteDecimal As Double dblNmero = Abs(Nmero) intSigno = Sgn(Nmero)

If NumDecimales >= 0 Then Nmero = WorksheetFunction.Round(Nmero, NumDecimales) intParteEntera = Int(Abs(Nmero)) intParteDecimal = Int(Round((Abs(Nmero) - intParteEntera) * 10 ^ NumDecimales, 0)) ElseIf NumDecimales < 0 Then intParteDecimal = 0 intParteEntera = Round((Abs(Nmero) / 10 ^ Abs(NumDecimales)), 0) * 10 ^ Abs(NumDecimales) End If If (intParteEntera = 0 And Not Cero) Or (intParteDecimal = 0 And Not Cero) Then Conexin = "" ' si no hay parte entera o decimal no ponemos el texto intermedio NumLetra = Strings.Trim(Entero_Letra(intParteEntera, Unidad, Cero, UD_un_uno_a) & " " & _ Conexin & " " & Entero_Letra(intParteDecimal, UdFracc, Cero, Frac_un_uno_a)) ' cuando el nmero sea negativo If intSigno = -1 Then NumLetra = "menos " & NumLetra End If End Function

Private Function Entero_Letra(Nmero As Double, Unidad As String, _ Cero As Boolean, un_o_a As Integer) As String ' funcin para convertir en texto nmeros enteros ' lo pongo como variable double en vez de entero largo, por si es un nmero muy grande Const intMaxGrupo As Integer = 3 ' grupos de 6 cifras considerados. con 3 llegamos hasta Tri llones.

NumeroaLetra - 2

as

Dim strResultado As String ' aqu almacenaremos provisionalmente la cadena resultado Dim lngAuxNum As Long ' nmero auxiliar para convertir el nmero por partes, hasta seis cifr Dim Dim Dim Dim Dim IntUnidades As Integer, IntMillares As Integer ' millares y unidades de lngAuxNum dblAuxResto As Double ' nmero auxiliar, la parte todava por convertir strAuxUnidad As String Resultado As String i As Integer

Resultado = "" 'si tenemos un cero If Nmero = 0 Then Select Case Cero Case True Resultado = "cero " & Unidad Case False Resultado = "" End Select Entero_Letra = Strings.Trim(Resultado) Exit Function End If dblAuxResto = Abs(Nmero)

For i = 0 To intMaxGrupo ' tomamos el nmero de 6 en 6 cifras lngAuxNum = Round(((dblAuxResto / 10 ^ 6 - Int(dblAuxResto / 10 ^ 6)) * 10 ^ 6), 0) IntUnidades = Round((lngAuxNum / 10 ^ 3 - Int(lngAuxNum / 10 ^ 3)) * 10 ^ 3, 0) IntMillares = (lngAuxNum - IntUnidades) / 10 ^ 3 If lngAuxNum <> 0 Or i = 0 Then Select Case i Case 0 'unidades 'unidades strAuxUnidad = Strings.RTrim(" " & Unidad) Resultado = cifra_3(IntUnidades, False, un_o_a) & strAuxUnidad ' millares If IntMillares <> 0 Then strAuxUnidad = " mil" If IntMillares = 1 Then Resultado = Strings.Trim(cifra_3(IntMillares, False, 0) & strAuxUnidad & " " & Resultado) Else Resultado = Strings.Trim(cifra_3(IntMillares, False, un_o_a) & strAuxUnid ad & " " & Resultado) End If End If Case 1 ' millones ' millones If lngAuxNum = 1 Then strAuxUnidad = " milln" Else strAuxUnidad = " millones" End If Resultado = Strings.Trim(cifra_3(IntUnidades, False, 1) & strAuxUnidad & " " & ' mil millones If IntMillares <> 0 Then strAuxUnidad = " mil" If IntMillares = 1 Then Resultado = Strings.Trim(cifra_3(IntMillares, False, 0) & strAuxUnidad & Else Resultado = Strings.Trim(cifra_3(IntMillares, False, 1) & strAuxUnidad &

Resultado)

" " & Resultado) " " & Resultado)

End If End If Case 2 ' billones ' billones If lngAuxNum = 1 Then

NumeroaLetra - 3 Else strAuxUnidad = " billn"

Resultado)

strAuxUnidad = " billones" End If Resultado = Strings.Trim(cifra_3(IntUnidades, False, 1) & strAuxUnidad & " " & ' mil billones If IntMillares <> 0 Then strAuxUnidad = " mil" If IntMillares = 1 Then Resultado = Strings.Trim(cifra_3(IntMillares, False, 0) & strAuxUnidad & Else Resultado = Strings.Trim(cifra_3(IntMillares, False, 1) & strAuxUnidad &

" " & Resultado) " " & Resultado)

End If End If Case 3 ' Trillones ' Trillones If lngAuxNum = 1 Then strAuxUnidad = " trilln" Else strAuxUnidad = " trillones" End If Resultado = Strings.Trim(cifra_3(IntUnidades, False, 1) & strAuxUnidad & " " & ' mil trillones If IntMillares <> 0 Then strAuxUnidad = " mil" If IntMillares = 1 Then Resultado = Strings.Trim(cifra_3(IntMillares, False, 0) & strAuxUnidad & Else Resultado = Strings.Trim(cifra_3(IntMillares, False, 1) & strAuxUnidad &

Resultado)

" " & Resultado) " " & Resultado)

End If End If

Next

End Select End If dblAuxResto = Int(dblAuxResto / 10 ^ 6) 'para el siguiente ciclo If dblAuxResto = 0 Then Exit For ' si ya hemos acabado ", " "))

Entero_Letra = Strings.Trim(Replace(Resultado, " End Function

Private Function cifra_1(num As Integer, Cero As Boolean, un_o_a As Integer) As String ' funcin para convertir en texto nmeros de una cifra ' num el nmeroa convertir ' cero verdadero 0->"cero" falso 0->"" ' un_o_a 0: 1->"" 1: 1->"un" 2: 1->"uno" 3: 1->"una" Select Case num Case 0 If Cero Then cifra_1 = "cero" Else cifra_1 = "" End If Case 1 Select Case un_o_a Case 0 cifra_1 = "" Case 1 cifra_1 = "un" Case 2 cifra_1 = "uno" Case 3 cifra_1 = "una" End Select Case 2 cifra_1 = "dos" Case 3

NumeroaLetra - 4 cifra_1 Case 4 cifra_1 Case 5 cifra_1 Case 6 cifra_1 Case 7 cifra_1 Case 8 cifra_1 Case 9 cifra_1 End Select End Function = "tres" = "cuatro" = "cinco" = "seis" = "siete" = "ocho" = "nueve"

Private Function cifra_2(num As Integer, Cero As Boolean, un_o_a As Integer) As String ' funcin para convertir en texto nmeros de una cifra ' num el nmeroa convertir ' cero verdadero 0->"cero" falso 0->"" ' un_o_a 0: 1->"" 1: 1->"un" 2: 1->"uno" 3: 1->"una" Select Case num Case Is < 10 cifra_2 = cifra_1(num, Cero, un_o_a) Case 10 cifra_2 = "diez" Case 11 cifra_2 = "once" Case 12 cifra_2 = "doce" Case 13 cifra_2 = "trece" Case 14 cifra_2 = "catorce" Case 15 cifra_2 = "quince" Case 16 To 19 cifra_2 = "dieci" & cifra_1(num - 10, False, un_o_a) Case 20 cifra_2 = "veinte" Case 21 To 29 cifra_2 = "veinti" & cifra_1(num - 20, False, un_o_a) Case 30 cifra_2 = "treinta" Case 31 To 39 cifra_2 = "treinta y " & cifra_1(num - 30, False, un_o_a) Case 40 cifra_2 = "cuarenta" Case 41 To 49 cifra_2 = "cuarenta y " & cifra_1(num - 40, False, un_o_a) Case 50 cifra_2 = "cincuenta" Case 51 To 59 cifra_2 = "cincuenta y " & cifra_1(num - 50, False, un_o_a) Case 60 cifra_2 = "sesenta" Case 61 To 69 cifra_2 = "sesenta y " & cifra_1(num - 60, False, un_o_a) Case 70 cifra_2 = "setenta" Case 71 To 79 cifra_2 = "setenta y " & cifra_1(num - 70, False, un_o_a) Case 80 cifra_2 = "ochenta" Case 81 To 89 cifra_2 = "ochenta y " & cifra_1(num - 80, False, un_o_a) Case 90 cifra_2 = "noventa" Case 91 To 99 cifra_2 = "noventa y " & cifra_1(num - 90, False, un_o_a) End Select End Function Private Function cifra_3(num As Integer, Cero As Boolean, un_o_a As Integer) As String ' funcin para convertir en texto nmeros de una cifra

NumeroaLetra - 5 ' ' ' ' num el nmeroa convertir cero verdadero 0->"cero" falso 0->"" un_o_a 0: 1->"" 1: 1->"un" 2: 1->"uno" 3: 1->"una" se realizan llamadas a la funcion cifra_2 para valores inferiores a 100

Select Case num Case Is < 100 cifra_3 = cifra_2(num, Cero, un_o_a) Case 100 cifra_3 = "cien" Case 101 To 199 cifra_3 = "ciento " & cifra_2(num - 100, False, un_o_a) Case 200 To 299 If un_o_a = 3 Then cifra_3 = "doscientas " & cifra_2(num - 200, False, un_o_a) Else cifra_3 = "doscientos " & cifra_2(num - 200, False, un_o_a) End If Case 300 To 399 If un_o_a = 3 Then cifra_3 = "trescientas " & cifra_2(num - 300, False, un_o_a) Else cifra_3 = "trescientos " & cifra_2(num - 300, False, un_o_a) End If Case 400 To 499 If un_o_a = 3 Then cifra_3 = "cuatrocientas " & cifra_2(num - 400, False, un_o_a) Else cifra_3 = "cuatrocientos " & cifra_2(num - 400, False, un_o_a) End If Case 500 To 599 If un_o_a = 3 Then cifra_3 = "quinientas " & cifra_2(num - 500, False, un_o_a) Else cifra_3 = "quinientos " & cifra_2(num - 500, False, un_o_a) End If Case 600 To 699 If un_o_a = 3 Then cifra_3 = "seiscientas " & cifra_2(num - 600, False, un_o_a) Else cifra_3 = "seiscientos " & cifra_2(num - 600, False, un_o_a) End If Case 700 To 799 If un_o_a = 3 Then cifra_3 = "setecientas " & cifra_2(num - 700, False, un_o_a) Else cifra_3 = "setecientos " & cifra_2(num - 700, False, un_o_a) End If Case 800 To 899 If un_o_a = 3 Then cifra_3 = "ochocientas " & cifra_2(num - 800, False, un_o_a) Else cifra_3 = "ochocientos " & cifra_2(num - 800, False, un_o_a) End If Case 900 To 999 If un_o_a = 3 Then cifra_3 = "novecientas " & cifra_2(num - 900, False, un_o_a) Else cifra_3 = "novecientos " & cifra_2(num - 900, False, un_o_a) End If End Select End Function

S-ar putea să vă placă și