hi
I try using Ubound with arrays the code in module 1 is orginal to split specific sheets based on first sheet . the problem with code in module 2 . when I add ubound it populate error type mismatch . the aim using ubound to make fast the code . I expect the data will increase so I would make it fast by put the data in array . I marked bold the lines added to the orginal code so can any body guide me how fix the error please?
this is the code cuase the error in this line
For i = 2 To UBound(rr)
Sub divide_column()
Dim lRow, i As Long
Dim mFind As Range
Dim rr As Variant
Sheets("RP").Select
lRow = Range("B" & Rows.Count).End(xlUp).Row
For Each cell In Range("B2:B" & lRow)
For Each rr In Sheets(Array("rep1", "proc1"))
For i = 2 To UBound(rr)
With rr(i)
Set mFind = .Columns("B").Find(cell.Value)
If Not mFind Is Nothing Then
.Range("C" & mFind.Row).Value = cell.Offset(0, 1).Value
.Range("D" & mFind.Row).Value = cell.Offset(0, 2).Value
.Range("E" & mFind.Row).Value = cell.Offset(0, 3).Value
End If
End With
Next i
Next rr
Next cell
End Sub