Hi santosh226001
This code is in the attached...let me know of issues.
Option Explicit
Private Sub CommandButton1_Click()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim LR As Long
Dim LR2 As Long
Dim LC As Long
Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Item")
With ws1
LR = .Range("A" & .Rows.Count).End(xlUp).Row
LC = .Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
.AutoFilterMode = False
.Range("A4").AutoFilter Field:=1, Criteria1:="YES"
.Range(.Cells(5, 1), .Cells(LR, LC)).Copy
With ws2
LR2 = .Range("A" & .Rows.Count).End(xlUp).Row + 1
.Range("A" & LR2).PasteSpecial
End With
.Application.CutCopyMode = False
.Range(.Cells(5, 1), .Cells(LR, 1)).Value = "No"
.Range(.Cells(5, 2), .Cells(LR, 5)).ClearContents
.AutoFilterMode = False
End With
End Sub
Bookmarks