Hi
Here's the code with some comments.
Sub DoUpdate()
'dimension workbook/worksheet variables
Dim DataWB As Workbook
Dim OutSH As Worksheet
'set the data workbook to the variable
Set DataWB = Workbooks("Check List.xls")
'select the data workbook
DataWB.Activate
'cycle through all the sheets
For i = 1 To Sheets.Count
'select the next sheet
Sheets(i).Select
'start at column & and work through to the alst column
For j = 8 To Cells(Rows.Count, 1).End(xlUp).Row
If Not IsEmpty(Cells(j, "B")) Then 'there is an invoice number
' if there is an existing sheet, then do the set, otherwise step over and avoid the error
On Error Resume Next
Set OutSH = Nothing
Set OutSH = ThisWorkbook.Sheets(Cells(j, "A").Value)
On Error GoTo 0
'an output sheet has been found
If Not OutSH Is Nothing Then
'determine the next output row
outrow = WorksheetFunction.Match(Cells(j, "B").Value, OutSH.Range("C:C"), 0)
'output the data using the cells approach
OutSH.Cells(outrow, "H").Value = Cells(j, "C").Value
OutSH.Cells(outrow, "I").Value = Cells(j, "G").Value
OutSH.Cells(outrow, "J").Value = Cells(j, "H").Value
End If
End If
Next j
Next i
End Sub
If something still doesn't make sense, don't hesitate to ask.
rylo
Bookmarks