I need help for this task in excel, I have one large file and in there it has filters, first I need to filter it for FCDP 21, and that values I have to copy, then to repeat that filtering but for MSR 21, and there to paste that values, here is the code that I wrote but it doesnt work when it needs to paste the values.
Dim s As Range
Dim visible_source_cells As Range
Dim destination_cells As Range
Dim source_cell As Range
Dim dest_cell As Range
With Range("A2:R667")
.AutoFilter field:=5, Criteria1:="FCDP 21"
End With
Set s = Application.Selection
s.SpecialCells(xlCellTypeVisible).Select
Set visible_source_cells = Application.Selection
Set Source = Application.InputBox("Please select the destination cells:", Type:=8)
With Range("A2:R667")
.AutoFilter field:=5, Criteria1:="MSR M-1 21"
End With
Set destination_cells = Application.InputBox("Please select the destination cells:", Type:=8)
For Each source_cell In Source
source_cell.Copy
For Each dest_cell In destination_cells
If dest_cell.EntireRow.RowHeight <> 0 Then
dest_cell.PasteSpecial
Set destination_cells = dest_cell.Offset(1).Resize(destination_cells.Rows.Count)
Exit For
End If
Next dest_cell
Next source_cell
End Sub```