You are on page 1of 2

ANEXO 3.

CODIGO PARA GENRERACION DE NMEROS ALEATORIOS

Private Sub CommandButton1_Click() i = InputBox("Introduzca el numero de corridas que desea generar") For a = 1 To i Cells(1 + e, 1).Value = a Cells(1 + e, 1).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, SkipBlanks:=False, Transpose:=False Cells(1 + e, 2).Value = "=RANDBETWEEN(3,5)" Cells(1 + e, 2).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, SkipBlanks:=False, Transpose:=False Cells(1 + e, 3).Value = "=RANDBETWEEN(8,12)" Cells(1 + e, 3).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, SkipBlanks:=False, Transpose:=False b = Cells(1 + e, 3).Value For c = 1 To b Cells(1 + e, 4).Value = c Cells(1 + e, 5).Value = "=RandBetween(5, 10)" Cells(1 + e, 5).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False e = e + Cells(1 + e, 5).Value Next Operation:=xlNone, Operation:=xlNone, Operation:=xlNone,

For d = 1 To e Cells(d, 6) = "=RandBetween(8, 12)" Cells(d, 6).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Next For h = 1 To 6 Cells(e, h).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone With Selection.Borders(xlEdgeBottom) LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 Weight = xlThin End With Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Next Next End Sub

You might also like