Hi
See if this helps you.
Code:
Sub UpdateSheet2()
Dim rngSource As Range
Dim RegNum As String
Dim rngRegNum As Range
Dim varFound, i As Long
With Sheet1
Set rngSource = .Range("a3:h" & .Range("b" & .Rows.Count).End(xlUp).Row)
End With
With Sheet2
Set rngRegNum = .Range("b1:b" & .Range("b" & .Rows.Count).End(xlUp).Row)
End With
'//loop through all the reg. #
For i = 1 To rngSource.Rows.Count
'//reg. # in 2nd column
RegNum = rngSource.Cells(i, "b")
'//look for the reg # in sheet2
varFound = Application.Match(RegNum, rngRegNum, 0)
'//if found, update the data
If Not IsError(varFound) Then
'//found cell
With rngRegNum.Cells(varFound, 1)
.Offset(, -1).Value2 = rngSource.Cells(i, 1).Value2 'Customers Name
.Offset(, 1).Value2 = rngSource.Cells(i, 5).Value2 '1ST serice costs
.Offset(, 2).Value2 = rngSource.Cells(i, 6).Value2 '2nd service costs
.Offset(, 3).Value2 = rngSource.Cells(i, 7).Value2 'Bugeted costs
.Offset(, 4).Value2 = rngSource.Cells(i, 8).Value2 'End Date
End With
End If
Next
End Sub
Bookmarks