Sub datatransfer()
Dim j As Integer
Dim k As Integer
Dim n As Integer
Sheets("Master").Activate
sheetcounter = 2
k = 24
j = 1
Do
Do Until Cells(j, 1).Value = Worksheets(sheetcounter).Cells(15, 5).Value
j = j + 1
Loop
n = j + 1
Do
Worksheets(sheetcounter).Cells(k, 4).Value = Cells(n, 3).Value
Worksheets(sheetcounter).Cells(k, 2).Value = Cells(n, 2).Value
If Cells(n, 8).Value = "" Then
Worksheets(sheetcounter).Cells(k, 31).Value = Cells(n, 6).Value
Else
Worksheets(sheetcounter).Cells(k, 30).Value = Cells(n, 8).Value
Worksheets(sheetcounter).Cells(k, 31).Value = Cells(n, 6).Value
End If
k = k + 1
n = n + 1
Loop While Cells(n, 2).Value <> ""
sheetcounter = sheetcounter + 1
Loop Until sheetcounter = 500
End Sub
Dim j As Integer
Dim k As Integer
Dim n As Integer
Sheets("Master").Activate
sheetcounter = 2
k = 24
j = 1
Do
Do Until Cells(j, 1).Value = Worksheets(sheetcounter).Cells(15, 5).Value
j = j + 1
Loop
n = j + 1
Do
Worksheets(sheetcounter).Cells(k, 4).Value = Cells(n, 3).Value
Worksheets(sheetcounter).Cells(k, 2).Value = Cells(n, 2).Value
If Cells(n, 8).Value = "" Then
Worksheets(sheetcounter).Cells(k, 31).Value = Cells(n, 6).Value
Else
Worksheets(sheetcounter).Cells(k, 30).Value = Cells(n, 8).Value
Worksheets(sheetcounter).Cells(k, 31).Value = Cells(n, 6).Value
End If
k = k + 1
n = n + 1
Loop While Cells(n, 2).Value <> ""
sheetcounter = sheetcounter + 1
Loop Until sheetcounter = 500
End Sub