You are on page 1of 2

On Error Resume Next

Dim a, x, rw, i, col


With Sheets("Nivel1")

menu.Clear

If IsNumeric(buscar) then
With menu
.ColumnCount = 10
.ColumnWidths = "60 pt;80 pt;80 pt; 80 pt;80 pt"
.List = [a2:2].Value

.Clear
i = 1: col = 1
nxt: rw = Range(Cells(i, col), Cells(1000000, col)).Find(buscar, lookat:=2).Row

If rw = i Then Exit Sub


.AddItem
For a = 1 To 10000
.List(x, a - 1) = Cells(rw, a)
Next a
x = x + 1
i = rw
GoTo nxt1
End If

With menu
.ColumnCount = 10
.ColumnWidths = "60 pt;80 pt;80 pt; 80 pt;80 pt"
.List = [a2:2].Value

.Clear
i = 1: col = 2
nxt: rw = Range(Cells(i, col), Cells(1000000, col)).Find(buscar, lookat:=2).Row

If rw = i Then Exit Sub


.AddItem
For a = 1 To 10000
.List(x, a - 1) = Cells(rw, a)
Next a
x = x + 1
i = rw
GoTo nxt2
End If
End With

Dim a, x, rw, i, col


With Sheets("Nivel1")

If buscar = "" Then: Exit Sub


With menu
.ColumnCount = 10
.ColumnWidths = "60 pt;80 pt;80 pt; 80 pt;80 pt"
.List = [a2:2].Value
.Clear
i = 1: col = 1
nxt: rw = Range(Cells(i, col), Cells(1000000, col)).Find(buscar, lookat:=2).Row

If rw = i Then Exit Sub


.AddItem
For a = 1 To 10000
.List(x, a - 1) = Cells(rw, a)
Next a
x = x + 1
i = rw
GoTo nxt
End With
End With

End Sub

You might also like