código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/anexo...cÓdigo hoja Índice...

52
ANEXO Código de programación.

Upload: others

Post on 09-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

ANEXO

Código de programación.

Page 2: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

CÓDIGO HOJA ÍNDICE

'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES

Private Sub IndexIndic_Click()

Sheets("Métricas").Select

End Sub

'CommandButton de ÍNDICE a BENCHMARKING

Private Sub IndexBench_Click()

Sheets("Benchmarking").Select

End Sub

'CommandButton de ÍNDICE a lista de NECESIDADES

Private Sub IndexNec_Click()

Sheets("Necesidades").Select

End Sub

'CommandButton de ÍNDICE a QFD

Private Sub IndexQFD_Click()

Sheets("QFD").Select

End Sub

CÓDIGO HOJA BENCHMARKING

'CommandButton: Benchmarking_Índice

Private Sub BenchInd_Click()

Sheets("Índice").Select

End Sub

'CommandButton: Benchmarking_QFD

Private Sub BenchQFD_Click()

Sheets("QFD").Select

End Sub

Page 3: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Private Sub DatProdButton_Click()

Call DatosExtProd

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

‘Declaración de variables

Dim UltLineaBen As Long

Dim ben As Integer

ben = ActiveSheet.Range("H5")

UltLineaBen = Range("A" & Rows.Count).End(xlUp).Row

Application.ScreenUpdating = False

If Target.Column = 1 Then

If Cells(Target.Row, 1).Value = "" And Target.Row <> (UltLineaBen + 1) And ben > 0 Then

Range("A" & Target.Row).Select

Selection.Delete Shift:=xlUp

End If

End If

Application.ScreenUpdating = True

End Sub

CÓDIGO HOJA NECESIDADES

'Botón para importar métricas desde .txt

Private Sub DatExtButton_Click()

Call DatosExtNec

End Sub

Page 4: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'CommandButton: Necesidades_Índice

Private Sub NecIndex_Click()

Sheets("Índice").Select

End Sub

'CommandButton: Necesidades_Benchmarking

Private Sub NecBench_Click()

Sheets("Benchmarking").Select

End Sub

'CommandButton: Necesidades_Métricas

Private Sub NecMet_Click()

Sheets("Métricas").Select

End Sub

'CommandButton: Necesidades_QFD

Private Sub NecQFD_Click()

Sheets("QFD").Select

End Sub

'Botón para PRIORIZAR NECESIDADES y mostrar el FORMULARIO...

Private Sub PriorizNec_Click()

PriorizNecForm.Show

End Sub

'Botón para ORGANIZAR LAS NECESIDADES y mostrar el FORMULARIO...

Private Sub OrgNec_Click()

answer = MsgBox("¿Desea eliminar alguna necesidad redundante?", vbYesNo + vbQuestion)

If answer = vbYes Then

'No hacemos nada...porque debe aparecer página con lista de necesidades y al eliminar

alguna...

'...necesidad debe ejecutarse código ...Private Sub Worksheet_Calculate()...

Else

Worksheets.Add(After:=Worksheets("Necesidades")).Name = "Necesidades organizadas"

Sheets("Necesidades").Select

Page 5: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

OrganizNec.Show

End If

End Sub

'Botón de AYUDA para PRIORIZAR NECESIDADES...

Private Sub PriorizHelpButton_Click()

Ayuda1.Show

End Sub

'Control de procedimiento de priorización SUMA FIJA...

Sub ControlSuma()

Dim i As Integer

Dim UltLineaNec As Long

Dim val As Integer

UltLineaNec = Range("A" & Rows.Count).End(xlUp).Row

For i = 0 To UltLineaNec - 1

val = val + Sheets("Necesidades").Range("B1").Offset(i, 0).Value

Next i

If val = 100 Then

MsgBox "Ha asignado todos los puntos disponibles (100)", vbInformation

End If

End Sub

'REORGANIZAR LISTA

Private Sub Worksheet_Change(ByVal Target As Range)

‘Declaración de variables

Dim UltLineaNec As Long

Dim nec As Integer

nec = ActiveSheet.Range("D2")

Page 6: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

UltLineaNec = Range("A" & Rows.Count).End(xlUp).Row

Application.ScreenUpdating = False

If Target.Column = 1 Then

If Cells(Target.Row, 1).Value = "" And Target.Row <> (UltLineaNec + 1) And nec > 0 Then

Range("A" & Target.Row).Select

Selection.Delete Shift:=xlUp

End If

End If

Application.ScreenUpdating = True

End Sub

CÓDIGO HOJA QFD

'CommandButton: QFD_Índice

Private Sub ButtonQFDIndex_Click()

Sheets("Índice").Select

End Sub

'CommandButton: QFD_Indicadores

Private Sub QFDMet_Click()

Sheets("Métricas").Select

End Sub

'CommandButton: QFD_Necesidades

Private Sub QFDNec_Click()

Sheets("Necesidades").Select

End Sub

Page 7: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'ANÁLISIS COMPETITIVO de la casa de la calidad

Private Sub BenchmButton_Click()

Call AnComp

End Sub

'BENCHMARKING TÉCNICO de la casa de la calidad

Private Sub BenchTcnButton_Click()

Call BenTcn

End Sub

'RESULTADOS de la casa de la calidad

Private Sub ResButton_Click()

Call FinQFD

End Sub

'TEJADO de la casa de la calidad

Private Sub RelEsp_Click()

Call RoofHoQ

End Sub

'Opción de imprimir...

Private Sub PrintCurrentSheet_Click()

ActiveSheet.PrintOut

End Sub

'CommandButton EJECUTAR

Private Sub RunButton_Click()

Call CompCellsNec

Call CompCellsMet

Call CompHoQ

End Sub

Page 8: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'CommandButton LIMPIAR

Private Sub CleanButton_Click()

Call LimpiarHoQNec

Call LimpiarHoQMet

Call LimpiarComHoQ

End Sub

'CommandButton: Valores IDEALES/ OBJETIVOS

Private Sub ValIdObjButton_Click()

Call ValueIdObjetive

End Sub

CÓDIGO HOJA MÉTRICAS

Private Sub DatMetButton_Click()

Call DatosExtMet

End Sub

'Establecer UNIDADES a los indicadores

Private Sub UnitsInd_Click()

UnitsMet.Show

End Sub

'CommandButton: Índice

Private Sub MetIndex_Click()

Sheets("Índice").Select

End Sub

'CommandButton: Lista de necesidades

Private Sub MetNec_Click()

Sheets("Necesidades").Select

End Sub

Page 9: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'CommandButton: Benchmarking

Private Sub MetBench_Click()

Sheets("Benchmarking").Select

End Sub

'CommandButton: QFD

Private Sub MetQFD_Click()

Sheets("QFD").Select

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

Dim UltLineaMet As Long

Dim met As Integer

met = ActiveSheet.Range("E2")

UltLineaMet = Range("A" & Rows.Count).End(xlUp).Row

Application.ScreenUpdating = False

If Target.Column = 1 Then

If Cells(Target.Row, 1).Value = "" And Target.Row <> (UltLineaMet + 1) And met > 0 Then

Range("A" & Target.Row).Select

Selection.Delete Shift:=xlUp

End If

End If

Application.ScreenUpdating = True

End Sub

Page 10: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

CÓDIGO FORMULARIOS

ESCALA NUMÉRICA

'Botón APLICAR...

Private Sub CommandButton1_Click()

Dim n As Object

Dim Dir As Integer

Dim pun As Variant

necp = LDNec.Value

Set n = Sheets("Necesidades").Range("A:A").Find(necp)

Dir = Range(n.Address).Row

pun = LDPunt.Value

Sheets("Necesidades").Select

Cells(Dir, 2).Select

With Selection

.Value = pun

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Me.LDNec.Clear

Me.LDPunt.Clear

End Sub

'Botón CANCELAR...

Private Sub CommandButton2_Click()

End

End Sub

Page 11: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Private Sub RepPropButton_Click()

‘Declaración de variables

Dim i As Integer

Dim UltLin As Long

Dim suma As Integer

Dim valor As Integer

Dim total As Variant

Sheets("Necesidades").Activate

UltLin = Range("A" & Rows.Count).End(xlUp).Row

For i = 0 To UltLin - 1

suma = suma + Range("B1").Offset(i, 0).Value

Next i

For i = 0 To UltLin - 1

If Range("B1").Offset(i, 0).Value <> "" Then

valor = Sheets("Necesidades").Range("B1").Offset(i, 0).Value

Sheets("Necesidades").Range("C1").Offset(i, 0).NumberFormat = "0.00%"

total = valor / suma

Range("C1").Offset(i, 0).Select

With Selection

.Value = total

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

End If

Page 12: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Next i

End Sub

Private Sub LDNec_Enter()

Sheets("Necesidades").Activate

Me.LDNec.Clear

For x = 1 To Range("A" & Rows.Count).End(xlUp).Row

If Cells(x, 1) <> Empty Then LDNec.AddItem Range("A" & x).Value

Next x

End Sub

Private Sub LDPunt_Enter()

LDPunt.Clear

Sheets("Puntuación").Activate

Range("A1").Select

Do While ActiveCell.Value <> ""

LDPunt.AddItem ActiveCell

ActiveCell.Offset(1, 0).Select

Loop

Sheets("Necesidades").Activate

End Sub

ORGANIZAR NECESIDADES

Private Sub CancelButton1_Click()

End

End Sub

Private Sub CancelButton2_Click()

End

End Sub

Page 13: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Private Sub ComboBox1_Click()

'ComboBox1.RemoveItem (Me.ComboBox1.ListIndex)

End Sub

Private Sub ApButton_Click()

Dim iCtr As Long

Dim i As Integer

Dim j As Integer

Dim uf As Integer

Dim UltLinea As Integer

uf = Sheets("Necesidades organizadas").Range("A" & Rows.Count).End(xlUp).Row

prim = ComboBox1.Value

Sheets("Necesidades organizadas").Range("A1").Offset(uf, 0).Font.Bold = True

Sheets("Necesidades organizadas").Range("A1").Offset(uf, 0) = prim

'Me.ComboBox1.Clear

ComboBox1.RemoveItem (Me.ComboBox1.ListIndex)

Me.ListNecPrimBox.RemoveItem ListIndex

Sheets("Necesidades organizadas").Select

For i = 0 To Me.ListBox1.ListCount - 1

If Me.ListBox1.Selected(i) = True Then

uf = Sheets("Necesidades organizadas").Range("A" & Rows.Count).End(xlUp).Row

Sheets("Necesidades organizadas").Range("A1").Offset(uf, 0) = ListBox1.List(i)

End If

Next i

For iCtr = Me.ListBox1.ListCount - 1 To 0 Step -1

If Me.ListBox1.Selected(iCtr) = True Then

Me.ListBox1.RemoveItem iCtr

Me.ListNecBox.RemoveItem iCtr

End If

Next iCtr

Page 14: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

End Sub

Private Sub AceptarButton2_Click()

answer = MsgBox("¿Está seguro que desea finalizar?", vbYesNo + vbQuestion)

Application.ScreenUpdating = False

If answer = vbYes Then

UltLinea = Sheets("Necesidades organizadas").Range("A" & Rows.Count).End(xlUp).Row

Range("A2:A" & UltLinea).Select

Selection.Copy

Sheets("Necesidades").Select

Range("A1").Select

ActiveSheet.Paste

Sheets("Necesidades").Select

UltLinea = Sheets("Necesidades").Range("A" & Rows.Count).End(xlUp).Row

Range("A1:A" & UltLinea).Select

With Selection.Interior

.Pattern = xlSolid

.PatternColorIndex = xlAutomatic

.color = 6750105

End With

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

End With

Sheets("Necesidades organizadas").Delete

End

Application.ScreenUpdating = True

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

Page 15: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'BOTONES PARA DESPLAZARNOS ENTRE LAS PESTAÑAS DEL FORMULARIO...

Private Sub NextButton1_Click()

MultiPage1.Value = 1

End Sub

'Pestaña anterior

Private Sub BackButton1_Click()

MultiPage1.Value = 0

End Sub

'CommandButton para actualizar ListBox1...

Private Sub RefreshIcon_Click()

Dim iCtr As Long

Me.ListBox1.Clear

For iCtr = 0 To Me.ListNecBox.ListCount - 1

Me.ListBox1.AddItem Me.ListNecBox.List(iCtr)

Next iCtr

End Sub

'Completar ListNecBox con lista de necesidades...

Private Sub ListNecBox_Enter()

Me.ListNecBox.Clear

For x = 1 To Range("A" & Rows.Count).End(xlUp).Row

If Cells(x, 1) <> Empty Then ListNecBox.AddItem Range("A" & x).Value

Next x

End Sub

'Botón para agregar items al listbox de necesidades primarias...(AGREGAR)

Private Sub AddButton_Click()

Dim iCtr As Long

For iCtr = 0 To Me.ListNecBox.ListCount - 1

If Me.ListNecBox.Selected(iCtr) = True Then

Me.ListNecPrimBox.AddItem Me.ListNecBox.List(iCtr)

Page 16: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Me.ComboBox1.AddItem Me.ListNecBox.List(iCtr)

End If

Next iCtr

For iCtr = Me.ListNecBox.ListCount - 1 To 0 Step -1

If Me.ListNecBox.Selected(iCtr) = True Then

Me.ListNecBox.RemoveItem iCtr

End If

Next iCtr

End Sub

'Botón para agregar items al listbox de todas las necesidades...(QUITAR)

Private Sub QuitButton_Click()

Dim iCtr As Long

For iCtr = 0 To Me.ListNecPrimBox.ListCount - 1

If Me.ListNecPrimBox.Selected(iCtr) = True Then

Me.ListNecBox.AddItem Me.ListNecPrimBox.List(iCtr)

End If

Next iCtr

For iCtr = Me.ListNecPrimBox.ListCount - 1 To 0 Step -1

If Me.ListNecPrimBox.Selected(iCtr) = True Then

Me.ListNecPrimBox.RemoveItem iCtr

Me.ComboBox1.RemoveItem iCtr

End If

Next iCtr

End Sub

Page 17: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

PRIORIZAR NECESIDADES

'Botón ACEPTAR...

Private Sub CommandButton1_Click()

PriorizNecForm.Hide

If OptionButton1.Value = True Then

EscNumForm.Show

End If

If OptionButton2.Value = True Then

SumFijaForm.Show

End If

End Sub

'Botón CANCELAR...

Private Sub CommandButton2_Click()

End

End Sub

SUMA FIJA

Private Sub CommandButton1_Click()

'If val < 0 Then

'MsgBox "Recuerda que tiene 100 puntos a repartir entre todas las necesidades",

vbInformation

'End If

Dim valMax As Integer

Dim val As Integer

Dim pun As Variant

Dim n As Object

Dim Dir As Integer

Dim i As Integer

Dim UltLin As Long

Page 18: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Sheets("Necesidades").Activate

UltLin = Range("A" & Rows.Count).End(xlUp).Row

For i = 0 To UltLin - 1

val = val + Range("B1").Offset(i, 0).Value

Next i

valMax = 100 - val

pun = PunSumFijaBox.Text

If val + pun = 100 Then

MsgBox "Ha asignado todos los puntos disponibles (100)", vbInformation

End If

'Busco la fila de la necesidad seleccionada mediante lista despegable...

necp = LDNecp.Value

Set n = Sheets("Necesidades").Range("A:A").Find(necp)

Dir = Range(n.Address).Row

If pun > valMax Then

MsgBox "Ha excedido la puntuación máxima disponible. Recuerde dispone de 100 puntos a

distribuir entre todos los enunciados de necesidades", vbInformation

val = val - pun

Me.LDNecp.Clear

Me.PunSumFijaBox.Text = ""

End If

If pun <= valMax Then

Sheets("Necesidades").Select

Cells(Dir, 2).Select

With Selection

.Value = pun

Page 19: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Me.LDNecp.Clear

Me.PunSumFijaBox.Text = ""

End If

End Sub

'botón FINALIZAR...

Private Sub CommandButton2_Click()

answer = MsgBox("¿Está seguro que desea finalizar? Recuerde que no se imprimirá la última

selección si no ha ejecutado previamente Aplicar.", vbYesNo + vbQuestion)

If answer = vbYes Then

End

'Organizamos...

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

Private Sub CommandButton3_Click()

Dim i As Integer

Dim UltLin As Long

Dim suma As Integer

Dim valor As Integer

Dim total As Variant

Page 20: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Sheets("Necesidades").Activate

UltLin = Range("A" & Rows.Count).End(xlUp).Row

For i = 0 To UltLin - 1

suma = suma + Range("B1").Offset(i, 0).Value

Next i

For i = 0 To UltLin - 1

If Range("B1").Offset(i, 0).Value <> "" Then

valor = Sheets("Necesidades").Range("B1").Offset(i, 0).Value

Sheets("Necesidades").Range("C1").Offset(i, 0).NumberFormat = "0.00%"

total = valor / suma

Range("C1").Offset(i, 0).Select

With Selection

.Value = total

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

End If

Next i

End Sub

Private Sub LDNecp_Enter()

Sheets("Necesidades").Activate

Me.LDNecp.Clear

Page 21: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

For x = 1 To Range("A" & Rows.Count).End(xlUp).Row

If Cells(x, 1) <> Empty Then LDNecp.AddItem Range("A" & x).Value

Next x

End Sub

Private Sub SpinButton1_Change()

PunSumFijaBox.Text = SpinButton1.Value

End Sub

UNIDADES DE MÉTRICAS

Private Sub FinUnitsMet_Click()

answer = MsgBox("¿Está seguro que desea finalizar? Recuerde que no se imprimirá la última

selección si no ha ejecutado previamente Aplicar.", vbYesNo + vbQuestion)

If answer = vbYes Then

End

'Organizamos...

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

Private Sub MetBox_Enter()

Sheets("Métricas").Activate

Me.MetBox.Clear

For x = 1 To Range("A" & Rows.Count).End(xlUp).Row

If Cells(x, 1) <> Empty Then MetBox.AddItem Range("A" & x).Value

Next x

End Sub

Private Sub CommandButton1_Click()

Dim c As Object

Dim Dir As Integer

Dim udad As Variant

Page 22: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

met = MetBox.Value

Set c = Sheets("Métricas").Range("A:A").Find(met)

Dir = Range(c.Address).Row

If UnitsSym.Value = "" Then

udad = TextBox1.Value

Else

udad = UnitsSym.Value

End If

Sheets("Métricas").Select

Cells(Dir, 2).Select

With Selection

.Value = udad

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Me.MetBox.Clear

Me.UnitsName.Clear

Me.UnitsSym.Clear

Me.TextBox1.Text = ""

End Sub

Private Sub UnitsSym_Enter()

UnitsSym.Clear

Sheets("Unidades").Activate

indice = UnitsName.ListIndex + 1

Cells(2, indice).Select

Do While ActiveCell.Value <> ""

UnitsSym.AddItem ActiveCell

Page 23: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

ActiveCell.Offset(1, 0).Select

Loop

Sheets("Métricas").Select

End Sub

Private Sub UnitsName_Enter()

UnitsName.Clear

Sheets("Unidades").Activate

Range("A1").Select

Do While ActiveCell.Value <> ""

UnitsName.AddItem ActiveCell

ActiveCell.Offset(0, 1).Select

Loop

Sheets("Métricas").Activate

End Sub

CÓDIGO MÓDULOS

ANÁLISIS COMPETITIVO

Sub AnComp()

'ANÁLISIS COMPETITIVO...

Application.ScreenUpdating = False

'Declaración de variables

Dim ben As Variant

Dim nec As Variant

'Declaración de índices de bucles For

Dim i As Integer

Dim j As Integer

Page 24: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'Asignar valor a variables "ben", "nec", "met"...

ben = Sheets("Benchmarking").Range("H5")

nec = Sheets("Necesidades").Range("D2")

'Creamos una nueva hoja llamada ..."BenchQFD"...

Worksheets.Add(After:=Worksheets("QFD")).Name = "Análisis competitivo"

Sheets("Análisis competitivo").Select

Range("B3").Select

Selection.Font.Bold = True

Selection.Font.Size = 24

ActiveCell.FormulaR1C1 = "ANÁLISIS COMPETITIVO/ COMPETITIVE ANALYSIS"

'Subrayado...

Selection.Font.Underline = xlUnderlineStyleSingle

For i = 1 To nec

Sheets("Análisis competitivo").Activate

Range("B7:D7").Offset(i, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Necesidades").Select

Range("A1").Offset(i - 1, 0).Select

Selection.Copy

Sheets("Análisis competitivo").Select

Range("B7:D7").Offset(i, 0).Select

ActiveSheet.Paste

Page 25: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = True

.ReadingOrder = xlContext

End With

Next i

For j = 1 To ben

Sheets("Análisis competitivo").Activate

Range("D5:D7").Offset(0, j).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Benchmarking").Select

Range("A7").Offset(j - 1, 0).Select

Selection.Copy

Sheets("Análisis competitivo").Select

ActiveSheet.Paste

Application.CutCopyMode = False

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = True

.ReadingOrder = xlContext

End With

Page 26: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Next j

For i = 1 To nec

For j = 1 To ben

Range("E8").Offset(i - 1, j - 1).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next j

Next i

'Quitamos la cuadrícula de la hoja...

ActiveWindow.DisplayGridlines = False

Application.ScreenUpdating = True

MsgBox "En este análisis competitivo se establecerá la importancia de las necesidades de los

productos competidores. Utilice una escala 1-5", vbInformation

End Sub

BENCHMARKING TÉCNICO

Sub BenTcn()

'BENCHMARKING TÉCNICO...

Application.ScreenUpdating = False

'Declaración de variables

Dim ben As Variant

Dim met As Variant

'Declaración de índices de bucles For

Dim i As Integer

Dim j As Integer

Page 27: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'Asignar valor a variables "ben", "nec", "met"...

ben = Sheets("Benchmarking").Range("H5")

met = Sheets("Métricas").Range("E2")

'Creamos una nueva hoja llamada ..."BenchQFD"...

Worksheets.Add(After:=Worksheets("QFD")).Name = "Benchmarking técnico"

Sheets("Benchmarking técnico").Select

Range("B3").Select

Selection.Font.Bold = True

Selection.Font.Size = 24

ActiveCell.FormulaR1C1 = "BENCHMARKING TÉCNICO/ TECHNICAL BENCHMARKING"

Selection.Font.Underline = xlUnderlineStyleSingle

For i = 1 To met

Sheets("Benchmarking técnico").Activate

Range("B7:D7").Offset(i, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Métricas").Select

Range("A1").Offset(i - 1, 0).Select

Selection.Copy

Sheets("Benchmarking técnico").Select

Range("B7:D7").Offset(i, 0).Select

ActiveSheet.Paste

With Selection

Page 28: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

End With

Next i

For j = 1 To ben

Sheets("Benchmarking técnico").Activate

Range("E5:E7").Offset(0, j).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Benchmarking").Select

Range("A7").Offset(j - 1, 0).Select

Selection.Copy

Sheets("Benchmarking técnico").Select

ActiveSheet.Paste

Application.CutCopyMode = False

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

End With

Next j

Page 29: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

For i = 1 To met

For j = 1 To ben + 1

Range("E8").Offset(i - 1, j - 1).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next j

Next i

'Copiar las UNIDADES...

For i = 0 To met - 1

Sheets("Métricas").Activate

Range("B1").Offset(i, 0).Select

Selection.Copy

Sheets("Benchmarking técnico").Activate

Range("E8").Offset(i, 0).Select

Selection.NumberFormat = "General"

ActiveSheet.Paste

Application.CutCopyMode = False

'Adecuar al formato de celdas...(quitar relleno y bordes exteriores)

With Selection.Interior

.Pattern = xlNone

.TintAndShade = 0

.PatternTintAndShade = 0

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next i

'Celda combinada con título: Unidades...

Range("E5:E7").Select

With Selection

.HorizontalAlignment = xlCenter

Page 30: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

ActiveCell.FormulaR1C1 = "Unidades"

Range("E5:E7").Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

.ReadingOrder = xlContext

End With

'Quitamos la cuadícula de la hoja...

ActiveWindow.DisplayGridlines = False

Application.ScreenUpdating = True

MsgBox "En el benchmarking técnico se establecerán los valores (rango de valores) de los

productos competidores. Recuerde asignar a todas las métricas sus unidades", vbInformation

End Sub

COMPOSICIÓN MATRICES

Sub CompCellsNec()

Application.ScreenUpdating = False

Dim fil As Variant

Dim j As Integer

fil = Sheets("Necesidades").Range("D2")

Page 31: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

For j = 1 To fil

Sheets("QFD").Activate

Range("E9:G9").Offset(j, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Necesidades").Select

Range("A1").Offset(j - 1, 0).Select

Selection.Copy

Sheets("QFD").Select

Range("E9:G9").Offset(j, 0).Select

ActiveSheet.Paste

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = True

.ReadingOrder = xlContext

End With

Next j

'PRIORIZACIÓN...

For j = 1 To fil

'Copiar las prioridades y eliminar color de fondo de celdas...

Sheets("Necesidades").Select

Range("B1").Offset(j - 1, 0).Select

Selection.Copy

Sheets("QFD").Select

Page 32: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Range("D9").Offset(j, 0).Select

ActiveSheet.Paste

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = True

.ReadingOrder = xlContext

End With

With Selection.Interior

.Pattern = xlNone

.TintAndShade = 0

.PatternTintAndShade = 0

End With

Sheets("QFD").Activate

Range("D9").Offset(j, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next j

Application.ScreenUpdating = True

End Sub

Sub CompCellsMet()

Application.ScreenUpdating = False

Dim col As Variant

Dim i As Integer

Page 33: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

col = Sheets("Métricas").Range("E2")

For i = 1 To col

Sheets("QFD").Activate

Range("G6:G9").Offset(0, i).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Métricas").Select

Range("A1").Offset(i - 1, 0).Select

Selection.Copy

Sheets("QFD").Select

ActiveSheet.Paste

Application.CutCopyMode = False

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = True

.ReadingOrder = xlContext

End With

Next i

Application.ScreenUpdating = True

End Sub

Page 34: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Sub CompHoQ()

Application.ScreenUpdating = False

Dim K As Integer

Dim m As Integer

Dim fil As Variant

Dim colum As Variant

fil = Sheets("Necesidades").Range("D2")

colum = Sheets("Métricas").Range("E2")

Sheets("QFD").Activate

For K = 1 To fil

For m = 1 To colum

Range("H10").Offset(K - 1, m - 1).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next m

Next K

Application.ScreenUpdating = True

End Sub

LIMPIEZA MATRICES

Sub LimpiarHoQMet()

' Acceso directo: CTRL+l

Application.ScreenUpdating = False

Dim i As Integer

Dim colum As Integer

Page 35: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

colum = Sheets("Métricas").Range("E2")

For i = 1 To colum + 1

Sheets("QFD").Activate

Range("G6:G9").Offset(0, i).Select

Selection.ClearContents

Selection.UnMerge

Selection.Borders(xlEdgeLeft).LineStyle = xlNone

Selection.Borders(xlEdgeTop).LineStyle = xlNone

Selection.Borders(xlEdgeBottom).LineStyle = xlNone

Selection.Borders(xlEdgeRight).LineStyle = xlNone

Next i

Range("E6:G9").Select

With Selection.Borders(xlEdgeRight)

.LineStyle = xlContinuous

.Weight = xlThin

End With

Application.ScreenUpdating = True

End Sub

Sub LimpiarHoQNec()

' Acceso directo: CTRL+n

Application.ScreenUpdating = False

Dim fil As Integer

Dim j As Integer

Page 36: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

fil = Sheets("Necesidades").Range("D2")

For j = 1 To fil + 1

Range("D9").Offset(j, 0).Select

Selection.ClearContents

Selection.Borders(xlEdgeLeft).LineStyle = xlNone

Selection.Borders(xlEdgeTop).LineStyle = xlNone

Selection.Borders(xlEdgeBottom).LineStyle = xlNone

Selection.Borders(xlEdgeRight).LineStyle = xlNone

Sheets("QFD").Activate

Range("E9:G9").Offset(j, 0).Select

Selection.ClearContents

Selection.UnMerge

Selection.Borders(xlEdgeLeft).LineStyle = xlNone

Selection.Borders(xlEdgeTop).LineStyle = xlNone

Selection.Borders(xlEdgeBottom).LineStyle = xlNone

Selection.Borders(xlEdgeRight).LineStyle = xlNone

With Selection.Interior

.Pattern = xlNone

.TintAndShade = 0

.PatternTintAndShade = 0

End With

Next j

Sheets("QFD").Range("D6:D9").Select

With Selection.Borders(xlEdgeBottom)

.LineStyle = xlContinuous

.Weight = xlThin

Page 37: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

End With

Sheets("QFD").Range("E6:G9").Select

With Selection.Borders(xlEdgeBottom)

.LineStyle = xlContinuous

.Weight = xlThin

End With

Application.ScreenUpdating = True

End Sub

Sub LimpiarComHoQ()

Application.ScreenUpdating = False

‘Declaración de variables

Dim l As Integer

Dim z As Integer

Dim fil As Variant

Dim colum As Variant

fil = Sheets("Necesidades").Range("D2")

colum = Sheets("Métricas").Range("E2")

Sheets("QFD").Activate

For l = 1 To fil + 1

For z = 1 To colum + 1

Range("H10").Offset(l - 1, z - 1).Select

Selection.ClearContents

Selection.UnMerge

Selection.Borders(xlEdgeLeft).LineStyle = xlNone

Selection.Borders(xlEdgeTop).LineStyle = xlNone

Selection.Borders(xlEdgeBottom).LineStyle = xlNone

Page 38: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Selection.Borders(xlEdgeRight).LineStyle = xlNone

Next z

Next l

Application.ScreenUpdating = True

End Sub

DATOS EXTERNOS

Sub DatosExtNec()

answer = MsgBox("Recuerde que debe seleccionar la celda a partir de la cuál desea importar

los datos (A1). ¿Está seguro que desea continuar?", vbYesNo + vbQuestion)

If answer = vbYes Then

Dim DestBook As Workbook, SourceBook As Workbook

Dim DestCell As Range

Dim RetVal As Boolean

' Turn off screen updating.

Application.ScreenUpdating = False

' Set object variables for the active book and active cell.

Set DestBook = ActiveWorkbook

Set DestCell = ActiveCell

' Show the Open dialog box.

RetVal = Application.Dialogs(xlDialogOpen).Show("*.txt")

' If Retval is false (Open dialog canceled), exit the procedure.

If RetVal = False Then Exit Sub

' Set an object variable for the workbook containing the text file.

Set SourceBook = ActiveWorkbook

Page 39: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

' Copy the contents of the entire sheet containing the text file.

Range(Range("A1"), Range("A1").SpecialCells(xlLastCell)).Copy

' Activate the destination workbook and paste special the values

' from the text file.

DestBook.Activate

DestCell.PasteSpecial Paste:=xlValues

' Close the book containing the text file.

SourceBook.Close False

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

Sub DatosExtMet()

answer = MsgBox("Recuerde que debe seleccionar la celda a partir de la cuál desea importar

los datos (A1). ¿Está seguro que desea continuar?", vbYesNo + vbQuestion)

If answer = vbYes Then

Dim DestBook As Workbook, SourceBook As Workbook

Dim DestCell As Range

Dim RetVal As Boolean

' Turn off screen updating.

Application.ScreenUpdating = False

' Set object variables for the active book and active cell.

Set DestBook = ActiveWorkbook

Set DestCell = ActiveCell

' Show the Open dialog box.

Page 40: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

RetVal = Application.Dialogs(xlDialogOpen).Show("*.txt")

' If Retval is false (Open dialog canceled), exit the procedure.

If RetVal = False Then Exit Sub

' Set an object variable for the workbook containing the text file.

Set SourceBook = ActiveWorkbook

' Copy the contents of the entire sheet containing the text file.

Range(Range("A1"), Range("A1").SpecialCells(xlLastCell)).Copy

' Activate the destination workbook and paste special the values

' from the text file.

DestBook.Activate

DestCell.PasteSpecial Paste:=xlValues

' Close the book containing the text file.

SourceBook.Close False

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

Sub DatosExtProd()

answer = MsgBox("Recuerde que debe seleccionar la celda a partir de la cuál desea importar

los datos (A7). ¿Está seguro que desea continuar?", vbYesNo + vbQuestion)

If answer = vbYes Then

Dim DestBook As Workbook, SourceBook As Workbook

Dim DestCell As Range

Dim RetVal As Boolean

' Turn off screen updating.

Application.ScreenUpdating = False

Page 41: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

' Set object variables for the active book and active cell.

Set DestBook = ActiveWorkbook

Set DestCell = ActiveCell

' Show the Open dialog box.

RetVal = Application.Dialogs(xlDialogOpen).Show("*.txt")

' If Retval is false (Open dialog canceled), exit the procedure.

If RetVal = False Then Exit Sub

' Set an object variable for the workbook containing the text file.

Set SourceBook = ActiveWorkbook

' Copy the contents of the entire sheet containing the text file.

Range(Range("A1"), Range("A1").SpecialCells(xlLastCell)).Copy

' Activate the destination workbook and paste special the values

' from the text file.

DestBook.Activate

DestCell.PasteSpecial Paste:=xlValues

' Close the book containing the text file.

SourceBook.Close False

Else

'No hacemos nada para seguir con el trabajo que estabamos realizando...

End If

End Sub

RESULTADOS QFD

Sub FinQFD()

Dim nec As Integer

Dim met As Integer

Page 42: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Dim j As Integer

Dim val1 As Variant

Dim val2 As Variant

Dim sumaproduct As Variant

Dim total As Variant

Dim Sum As Variant

Dim rel As Variant

Dim esc As Variant

Application.ScreenUpdating = False

nec = Sheets("Necesidades").Range("D2").Value

met = Sheets("Métricas").Range("E2").Value

'INCIDENCIA TÉCNICA ABSOLUTA

Sheets("QFD").Activate

Range("E9:G9").Offset(nec + 1, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

ActiveCell.FormulaR1C1 = "Incidencia Téc. Absoluta"

With Selection.Interior

.Pattern = xlSolid

.PatternColorIndex = xlAutomatic

.color = 5287936

End With

'FÓRMULA SUMAPRODUCTO(;)...

Page 43: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

For i = 1 To met

For j = 1 To nec

Sheets("QFD").Activate

Range("H9").Offset(j, i - 1).Select

val1 = Selection.Value

Sheets("Necesidades").Activate

Range("C1").Offset(j - 1, 0).Select

val2 = Selection.Value

sumaproduct = sumaproduct + val1 * val2

Next j

Sheets("QFD").Activate

Range("G9").Offset(nec + 1, i).Select

If sumaproducto <> 0 Then

Selection.Value = sumaproduct

End If

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = False

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

'Inicializo la variable sumaproduct para la siguiente iteración...

sumaproduct = 0

Next i

'INCIDENCIA TÉCNICA RELATIVA

'Sheets("QFD").Activate

'Range("E9:G9").Offset(nec + 2, 0).Select

'With Selection

Page 44: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'.HorizontalAlignment = xlCenter

'.VerticalAlignment = xlBottom

'.ReadingOrder = xlContext

'.MergeCells = True

'End With

'Selection.BorderAround _

'LineStyle:=xlContinuous, Weight:=xlThin

'ActiveCell.FormulaR1C1 = "Incidencia Téc. Relativa"

'With Selection.Interior

'.Pattern = xlSolid

'.PatternColorIndex = xlAutomatic

'.color = 5287936

'End With

'For j = 1 To met

'Sheets("QFD").Activate

'Range("G9").Offset(nec + 1, j).Select

'total = total + Selection.Value

'Next j

'For j = 1 To met

'Sheets("QFD").Activate

'Range("G9").Offset(nec + 1, j).Select

'rel = Selection.Value

'esc = rel / total

'Range("G9").Offset(nec + 2, j).Select

'Selection.Value = esc

'With Selection

'.HorizontalAlignment = xlCenter

'.VerticalAlignment = xlBottom

'.ReadingOrder = xlContext

'End With

'Selection.BorderAround _

'LineStyle:=xlContinuous, Weight:=xlThin

Page 45: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'Next j

Application.ScreenUpdating = True

End Sub

RELACIÓN MÉTRICAS

Sub RoofHoQ()

Application.ScreenUpdating = False

'Declaración de variables

Dim met As Variant

Dim i As Integer

Dim j As Integer

Dim m As Integer

Dim K As Integer

met = Sheets("Métricas").Range("E2")

'Añadimos nueva hoja dónde generar el tejado de la casa de la calidad

Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Roof HoQ"

Sheets("Roof HoQ").Select

Range("C4").Select

Selection.Font.Bold = True

Selection.Font.Size = 20

ActiveCell.FormulaR1C1 = "RELACIÓN ENTRE ESPECIFICACIONES/ RELATIONSHIPS BETWEEN

ENGINEERING SPECIFICATIONS"

'Subrayado...

Selection.Font.Underline = xlUnderlineStyleSingle

'COLUMNAS...

For j = 1 To met

Page 46: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Sheets("Roof HoQ").Activate

Range("E8:E10").Offset(met + 1, j).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.WrapText = True

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Selection.Font.Bold = True

Sheets("Métricas").Select

Range("A1").Offset(j - 1, 0).Select

Selection.Copy

Sheets("Roof HoQ").Select

ActiveSheet.Paste

Application.CutCopyMode = False

Next j

'FILAS...

For i = 1 To met

Sheets("Roof HoQ").Activate

Range("C8:E8").Offset(i, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

Page 47: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

LineStyle:=xlContinuous, Weight:=xlThin

Selection.Font.Bold = True

Selection.Borders(xlInsideVertical).LineStyle = xlNone

Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Sheets("Métricas").Select

Range("A1").Offset(i - 1, 0).Select

Selection.Copy

Sheets("Roof HoQ").Select

ActiveSheet.Paste

Application.CutCopyMode = False

Next i

For K = 0 To met - 2

For m = K + 1 To met - 1

Range("F9").Offset(m, K).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next m

Next K

'Quitamos la cuadícula de la hoja...

ActiveWindow.DisplayGridlines = False

Application.ScreenUpdating = True

MsgBox "Debe tener en cuenta la posible relación (positiva o negativa) entre especificaciones.

Existen muchos símbolos posibles para definir esta relación pero, lo más simple es utilizar + y -.

En algunas circustancias si la relación es muy fuerte se puede utilizar ++ y --, respectivamente",

vbInformation

End Sub

Page 48: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

VALORES IDEALES/ OBJETIVOS

Sub ValueIdObjetive()

'VALORES IDEALES /OBJETIVOS...

Application.ScreenUpdating = False

'Declaración de variables

Dim met As Variant

'Declaración de índices de bucles For

Dim i As Integer

Dim j As Integer

met = Sheets("Métricas").Range("E2")

'Creamos una nueva hoja llamada ..."IdObj"...

Worksheets.Add(After:=Worksheets("QFD")).Name = "IdObj"

Sheets("IdObj").Select

Range("B3").Select

Selection.Font.Bold = True

Selection.Font.Size = 24

ActiveCell.FormulaR1C1 = "VALOR IDEAL / OBJETIVO"

Selection.Font.Underline = xlUnderlineStyleSingle

For i = 1 To met

Sheets("IdObj").Activate

Range("B7:D7").Offset(i, 0).Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

Page 49: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Sheets("Métricas").Select

Range("A1").Offset(i - 1, 0).Select

Selection.Copy

Sheets("IdObj").Select

Range("B7:D7").Offset(i, 0).Select

ActiveSheet.Paste

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

End With

Next i

'Copiar las UNIDADES...

'Celda combinada con título: Unidades...

Range("E5:E7").Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Selection.Font.Bold = True

ActiveCell.FormulaR1C1 = "Unidades"

Range("E5:E7").Select

With Selection

Page 50: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

.ReadingOrder = xlContext

End With

For i = 0 To met - 1

Sheets("Métricas").Activate

Range("B1").Offset(i, 0).Select

Selection.Copy

Sheets("IdObj").Activate

Range("E8").Offset(i, 0).Select

'Selection.NumberFormat = "General"

ActiveSheet.Paste

Application.CutCopyMode = False

'Adecuar al formato de celdas...(quitar relleno y bordes exteriores)

With Selection.Interior

.Pattern = xlNone

.TintAndShade = 0

.PatternTintAndShade = 0

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next i

Sheets("IdObj").Activate

Range("F5:H7").Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

.ReadingOrder = xlContext

.MergeCells = True

End With

Page 51: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Selection.Font.Bold = True

ActiveCell.FormulaR1C1 = "Mínimo aceptable"

Range("F5:H7").Select

Range("I5:K7").Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

.ReadingOrder = xlContext

.MergeCells = True

End With

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Selection.Font.Bold = True

ActiveCell.FormulaR1C1 = "Ideal"

For i = 1 To met

Range("F7:H7").Offset(i, 0).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Range("I7:K7").Offset(i, 0).Select

Selection.BorderAround _

LineStyle:=xlContinuous, Weight:=xlThin

Next i

'Quitamos la cuadícula de la hoja...

ActiveWindow.DisplayGridlines = False

Application.ScreenUpdating = True

Page 52: Código de programación.bibing.us.es/proyectos/abreproy/90709/fichero/ANEXO...CÓDIGO HOJA ÍNDICE 'CommandButton de ÍNDICE a lista de MÉTRICAS/ INDICADORES Private Sub IndexIndic_Click()

'MsgBox "En el benchmarking técnico se establecerán los valores (rango de valores) de los

productos competidores. Recuerde asignar a todas las métricas sus unidades", vbInformation

End Sub