Hello.
I have the following formula which searches another sheet gathers the relevant info then pastes it to Sheet 1 !
Problem is it overwrites all cells in all columns and I would like it to only fill column A to Column H ?
can you help me please ??
I have the following formula which searches another sheet gathers the relevant info then pastes it to Sheet 1 !
Problem is it overwrites all cells in all columns and I would like it to only fill column A to Column H ?
can you help me please ??
VBA Code:
Sub Test2()
Dim myWord$
myWord = InputBox("Type Purchase Order Number Below...", "Purchase Order Number")
If myWord = "" Then Exit Sub
Application.ScreenUpdating = False
Dim xRow&, NextRow&, LastRow&
NextRow = 11
LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For xRow = 1 To LastRow
If WorksheetFunction.CountIf(Rows(xRow), "*" & myWord & "*") > 0 Then
Rows(xRow).Copy Sheets("Sheet1").Rows(NextRow)
NextRow = NextRow + 1
End If
Next xRow
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: