Sub AleatórioMS() Dim N, N01, N02, N03, N04, N05, N06 As Integer N = 60 ActiveSheet.Range("A1").Value = Int((N * Rnd) + 1) ActiveSheet.Range("B1").Value = Int((N * Rnd) + 1) Subir1: N01 = Range("A1").Value N02 = Range("B1").Value If N02 = N01 Then ActiveSheet.Range("B1").Value = Int((N * Rnd) + 1) If N01 = N02 Then GoTo Subir1 End If End If ActiveSheet.Range("C1").Value = Int((N * Rnd) + 1) Subir2: N03 = Range("C1").Value If (N03 = N01 Or N03 = N02) Then ActiveSheet.Range("C1").Value = Int((N * Rnd) + 1) If (N03 = N01 Or N03 = N02) Then GoTo Subir2 End If End If ActiveSheet.Range("D1").Value = Int((N * Rnd) + 1) Subir3: N04 = Range("D1").Value If (N04 = N01 Or N04 = N02 Or N04 = N03) Then ActiveSheet.Range("D1").Value = Int((N * Rnd) + 1) If (N04 = N01 Or N04 = N02 Or N04 = N03) Then GoTo Subir3 End If End If ActiveSheet.Range("E1").Value = Int((N * Rnd) + 1) Subir4: N05 = Range("E1").Value If (N05 = N01 Or N05 = N02 Or N05 = N03 Or N05 = N04) Then ActiveSheet.Range("E1").Value = Int((N * Rnd) + 1) If (N05 = N01 Or N05 = N02 Or N05 = N03 Or N05 = N04) Then GoTo Subir4 End If End If ActiveSheet.Range("F1").Value = Int((N * Rnd) + 1) Subir5: N06 = Range("F1").Value If (N06 = N01 Or N06 = N02 Or N06 = N03 Or N06 = N04 Or N06 = N05) Then ActiveSheet.Range("F1").Value = Int((N * Rnd) + 1) If (N06 = N01 Or N06 = N02 Or N06 = N03 Or N06 = N04 Or N06 = N05) Then GoTo Subir5 End If End If End Sub