I have been trying to get a VBA code to work for copying all rows that have "New" in the B column then copy that row A-X
and open a different workbook than paste the data to the next empty row.
I have been able to get this to work but it stops after the first instance it identifies.
Public Sub ExporttoDatabase()
Windows("Qlty Workbook Daily1").Activate
Sheets("Today").Select
' Find the last row of data
FinalRow = Worksheets("Today").Cells(Rows.Count, 1).End(xlUp).Row
' Loop through each row
For i = 2 To FinalRow
' Decide if to copy based on column B
ThisValue = Cells(i, 2).Value
If ThisValue = "New" Then
Cells(i, 1).Resize(1, 24).Copy
Workbooks.Open Filename:="I:\Inventory\Quality Reports (Tim)\2019 Qlty Data-Running.xlsm"
Sheets("Data").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.Paste
End If
Next
Application.CutCopyMode = False
Windows("Qlty Workbook Daily1").Activate
Range("C3").Select
End Sub
and open a different workbook than paste the data to the next empty row.
I have been able to get this to work but it stops after the first instance it identifies.
Public Sub ExporttoDatabase()
Windows("Qlty Workbook Daily1").Activate
Sheets("Today").Select
' Find the last row of data
FinalRow = Worksheets("Today").Cells(Rows.Count, 1).End(xlUp).Row
' Loop through each row
For i = 2 To FinalRow
' Decide if to copy based on column B
ThisValue = Cells(i, 2).Value
If ThisValue = "New" Then
Cells(i, 1).Resize(1, 24).Copy
Workbooks.Open Filename:="I:\Inventory\Quality Reports (Tim)\2019 Qlty Data-Running.xlsm"
Sheets("Data").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.Paste
End If
Next
Application.CutCopyMode = False
Windows("Qlty Workbook Daily1").Activate
Range("C3").Select
End Sub