View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Wouter HM Wouter HM is offline
external usenet poster
 
Posts: 99
Default Comparing and updating sheets.

Hi sanjay,

It is clear now, thanks for the extra info.

Add this macro on your index sheet, you may need to edit it a
little...

Private Sub Worksheet_Change(ByVal Target As Range)

If FindOrder("IP_MPLS", Target) Then Exit Sub
If FindOrder("BB", Target) Then Exit Sub
If FindOrder("DGE", Target) Then Exit Sub
If FindOrder("IPLC VCIPLC", Target) Then Exit Sub
If FindOrder("Voice", Target) Then Exit Sub

End Sub


Private Function FindOrder(Str As String, _
Target As Range) As Boolean
Dim bln As Boolean
Dim row As Variant
Dim Sht As Worksheet

Set Sht = Worksheets(Str)

On Local Error Resume Next
row = Application.WorksheetFunction.Match( _
Target.Value, Sht.Range("A:A"), 0)
If Err.Number 0 Then
FindOrder = False
Exit Function
End If

Application.EnableEvents = False
Target.Offset(0, 1).Value = Str
Target.Offset(0, 2).Value = Sht.Cells(row, 21).Value
Target.Offset(0, 3).Value = Sht.Cells(row, 22).Value
Application.EnableEvents = True

FindOrder = True
End Function


HTH,

Wouter