Press Alt+F11 to open VBA window, then click on Insert--> Module and then paste the code given below in the opened VBA Code window. You are done.
The code given below will run only once i.e. if you run it repeatedly without adding new rows in any of your 16 sheets with a value >40 in col. H. So if you run this code twice by mistake it will not do the same action again.
Sub transferdata()
Dim ws As Worksheet
Dim rng As Range, cell As Range, rng1 As Range
Dim lr As Long, lr1 As Long, lrcnt As Long, cnt As Long, m As Long, n As Long
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "Major" Then
lr = ws.Cells(Rows.Count, "H").End(xlUp).Row
Set rng = ws.Range("H2:H" & lr)
n = Application.WorksheetFunction.CountIf(rng, ">40")
cnt = cnt + n
End If
Next ws
lr1 = Sheets("Major").Cells(Rows.Count, "H").End(xlUp).Row
Set rng1 = Sheets("Major").Range("H2:H" & lr1)
m = Application.WorksheetFunction.CountIf(rng1, ">40")
If m < cnt Then
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "Major" Then
lr = ws.Cells(Rows.Count, "H").End(xlUp).Row
Set rng = ws.Range("H2:H" & lr)
For Each cell In rng
lr1 = Sheets("major").Cells(Rows.Count, "H").End(xlUp).Row + 1
If cell.Value > 40 Then
cell.EntireRow.Copy Destination:=Sheets("Major").Range("A" & lr1)
End If
Next cell
End If
Next ws
End If
Sheets("Major").Activate
Application.ScreenUpdating = True
End Sub
Bookmarks