Copy matches to next empty row is not working

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
I have a function that Fluff was able to help me troubleshoot.
My quandary is now, when I fire the code to pull a copy of the Query from Access, it does pull another copy into the designated worksheet as written. That works has intended.
The problem stars here:
The next macro when chosen is supposed to look at the entire worksheet and copy all data that matches the criteria into the worksheet assigned. It does not work, but then it will sometimes copy a few lines, but I know there are more matches in the Access copy worksheet.
I want it to review the entire worksheet and pull all matches regardless of their appearing in assigned worksheet since this is a building spreadsheet.
What is going on?

Here is a copy of the macro:
Code:
Sub Workie()

  Dim LastRow, LR As Long
  Dim i As Long
  Dim j As Long
    
    LastRow = Cells(Rows.Count, "B").End(xlUp).Row
    j = LastRow + 1
    For i = 1 To LastRow
    
        If Sheets("IQP").Cells(i, 29) <> "" And Sheets("IQP").Cells(i, 11) = _
        "Assigned" And Sheets("IQP").Cells(i, 16) = "" Then
             Sheets("Workable").Cells(j, 2) = Sheets("IQP").Cells(i, 2).Value
             Sheets("Workable").Cells(j, 3) = Sheets("IQP").Cells(i, 10).Value 
             Sheets("Workable").Cells(j, 4) = Sheets("IQP").Cells(i, 9).Value 
             Sheets("Workable").Cells(j, 5) = Sheets("IQP").Cells(i, 29).Value 
             Sheets("Workable").Cells(j, 6) = Sheets("IQP").Cells(i, 5).Value 
             Sheets("Workable").Cells(j, 7) = Sheets("IQP").Cells(i, 6).Value 
             Sheets("Workable").Cells(j, 8) = Sheets("IQP").Cells(i, 30).Value 
             Sheets("Workable").Cells(j, 9) = Sheets("IQP").Cells(i, 8).Value 
             j = j + 1
        End If
    Next i
    
End Sub
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top