Might need to change the sheet names in the code on the first two lines, you never really specified what the first sheet is named.
Sub ScabbyDog()
Set ws1 = Sheets("Sheet1") ' The searched sheet
Set ws2 = Sheets("Sheet2") ' The pasted to sheet
SearchFor = ws1.Range("D1").Value
With ws1.Range("A:A")
Set c = .Find(SearchFor, lookat:=xlWhole, MatchCase:=False)
If Not c Is Nothing Then
FirstAdd = c.Address
Do
If Val(c.Offset(1, 0).Value) = Int(Val(c.Offset(1, 0).Value)) Then
ws1.Range(ws1.Cells(c.Row + 1, 2), ws1.Cells(c.Row + 16, 2)).Copy
ws2.Range("Z1").PasteSpecial Transpose:=True
Application.CutCopyMode = False
Exit Sub
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAdd
MsgBox ("Value in D1 was found, but with no whole number one cell below")
Exit Sub
Else
MsgBox ("Value in D1 was not found")
End If
End With
End Sub
Bookmarks