Hi rmomin,
Here's one way:
Option Explicit
Sub Macro1()
Dim wsSrc As Worksheet, wsDestin As Worksheet
Dim i As Long, j As Long
Application.ScreenUpdating = False
Set wsSrc = Sheets("Sheet1")
Set wsDestin = Sheets("Sheet2")
For i = 2 To wsSrc.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If StrConv(wsSrc.Range("A" & i), vbProperCase) = "Salary" Then
j = IIf(j = 0, 2, j + 1)
wsDestin.Range("A" & j).Value = wsSrc.Range("A" & i - 1)
wsDestin.Range("B" & j).Value = wsSrc.Range("B" & i - 1)
wsDestin.Range("C" & j).Value2 = wsSrc.Range("C" & i).Value2
wsDestin.Range("D" & j).Value = wsSrc.Range("D" & i - 1)
End If
Next i
Application.ScreenUpdating = True
End Sub
Regards,
Robert
Bookmarks