Hello bryenwalt,
The following macro has been added to the attached workbook. It will copy the data to the error sheets.
Sub CopyToErrorSheets()
Dim Cell As Range
Dim DstRng As Range
Dim DstWks As Worksheet
Dim ErrCells As Range
Dim Info As Variant
Dim R As Long
Dim RngEnd As Range
Dim SrcRng As Range
Dim SrcWks As Worksheet
Set SrcWks = Worksheets("Cap")
Set SrcRng = SrcWks.Range("A2:P2")
Set RngEnd = SrcWks.Cells(Rows.Count, SrcRng.Column).End(xlUp)
If RngEnd.Row < SrcRng.Row Then
MsgBox "This sheet contains no data."
Exit Sub
End If
Set SrcRng = SrcWks.Range(SrcRng, RngEnd)
Set ErrCells = SrcWks.Range("R2:V" & SrcRng.Rows.Count + 2 - 1)
For R = 1 To SrcRng.Rows.Count
Info = SrcRng.Rows(R).Value
For Each Cell In ErrCells.Rows(R).Cells
If Cell.Text <> "" Then
Set DstWks = Worksheets(Cell.Text)
Set DstRng = DstWks.Range("A3")
Set RngEnd = DstWks.Cells(Rows.Count, DstRng.Column).End(xlUp)
Set DstRng = IIf(RngEnd.Row < DstRng.Row, DstRng, RngEnd.Offset(1, 0))
DstRng.Resize(1, 16).Value = Info
End If
Next Cell
Next R
End Sub
Bookmarks