Bellaanima7
New Member
- Joined
- Jul 23, 2020
- Messages
- 22
- Office Version
- 365
- Platform
- Windows
Hi Guys,
I am trying to copy filtered data with matching headers, go to sheet2, identify last row and paste each matching headers data in a new row below it, it doesn't work as expected. It copies all data and pastes it in order, does anyone know how to tweak the code to only paste matching headers that are not in order on SurveyDB sheet?
I am trying to copy filtered data with matching headers, go to sheet2, identify last row and paste each matching headers data in a new row below it, it doesn't work as expected. It copies all data and pastes it in order, does anyone know how to tweak the code to only paste matching headers that are not in order on SurveyDB sheet?
VBA Code:
Private Sub Validation ()
'Move rows from FINAL worksheet that contain the word "New / Pending Validation" - column B
Worksheets("Final").Activate
With ActiveSheet
.AutoFilterMode = False
If Application.CountIf(.Range("B:B"), "*New / Pending Validation*") > 0 Then
With Range("B1", Range("B" & Rows.Count).End(xlUp))
.AutoFilter 1, "*New / Pending Validation*"
.Offset(1).SpecialCells(12).EntireRow.copy
End With
Else
Beep
MsgBox "New not found", vbInformation, "NO MATCH"
Exit Sub
End If
'Go to SurveyDB worksheet and paste records in first available row
Worksheets("SurveyDB").Activate
Range("A1048576").Select
Selection.End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Interior.Color = xlNone
Range("A1").Select
'Release copy mode from Final worksheet
Worksheets("Final").Activate
Application.CutCopyMode = False
' Undo Macro
Sheets("Final").Select
ActiveSheet.Range("$B$1:$B$958").AutoFilter Field:=1
End With
End Sub