Comparing and updating sheets.
Hi sanju,
In Excel 2007 I have created the code below.
Since I do not have any testing data I hoop this will work.
Be sure to test it on a copy of your Excel File!
' -- start of code
Option Explicit
Dim shtSource As Worksheet
Sub Caller()
Set shtSource = Worksheets("Activity")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
nehaAll "IP_MPLS"
nehaAll "BB"
nehaAll "DGE"
nehaAll "IPLC VCIPLC"
nehaAll "Voice"
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Set shtSource = Nothing
End Sub
Sub nehaAll(strTarget As String)
Dim shtTarget As Worksheet
Dim A As Integer
Dim B As Integer
Set shtTarget = Worksheets(strTarget)
For B = 2 To 50
For A = 3 To 50
If shtSource.Cells(B, 4).Value = shtTarget.Cells(A, 1).Value
Then
shtTarget.Cells(A, 32).Value = shtSource.Cells(B, 10).Value
shtTarget.Cells(A, 21).Value = shtSource.Cells(B, 1).Value
shtTarget.Cells(A, 22).Value = shtTarget.Cells(A, 22).Value &
_
". ;" & shtSource.Cells(B, 2).Value & ";" & _
shtSource.Cells(B, 8).Value
End If
Next A
Next B
Set shtTarget = Nothing
End Sub
'-- end of code
HTH,
Wouter
|