Macros mano
Sub tareaBoton1()
m = 3
While Worksheets("Hoja2").Cells(m, 2).Value <> ""
m = m + 1
Wend
m = m - 3
n = 3
While Worksheets("Hoja1").Cells(n, 2).Value <> ""
n = n + 1
Wend
n = n - 3
MsgBox m
MsgBox n
For i = 0 To (m - 1)
nombreCompleto2 = Split(Worksheets("Hoja2").Cells(i + 3, 2).Value)
length2 = UBound(nombreCompleto2) + 1
MsgBox i
For j = 0 To (n - 1)
nombreCompleto1 = Split(Worksheets("Hoja1").Cells(j + 3, 2).Value)
length1 = UBound(nombreCompleto1) + 1
h = 0
MsgBox j
For k = 0 To (length2 - 1)
For l = 0 To (length1 - 1)
If nombreCompleto2(k) = nombreCompleto1(l) Then
h = h + 1
End If
Next
Next
If h >= (length2 - 1) Then
Worksheets("Hoja2").Cells(i + 3, 4).Value = Worksheets("Hoja1").Cells(j + 3, 3).Value
MsgBox "Copiado" & (i + 3) & (j + 3)
End If
Next
Next
'For i = LBound(nombreCompleto1) To UBound(nombreCompleto1)
' txt = txt & nombreCompleto1(i) & vbCrLf
'Next i
MsgBox "Realizado"
'MsgBox (txt)
'MsgBox (nombreCompleto1)
'MsgBox (length1)
'MsgBox (m)
'MsgBox (n)
'MsgBox (length2)
End Sub
No hay comentarios:
Publicar un comentario