Copy to next empty row is not working

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
Help!

I have not had this problem before, but my macro is now copying over the current data instead of appending in the next empty row.
I need this to look at the date (today), if the data is already there, do nothing. If not today then take the data and place each instance in the next available row.

This copies multiple rows that match the criteria, but now it is overwriting the data already present in the worksheet("Workable").

Code:
Sub Wordie()


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

I cannot figure out what is going on!

DThib
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try
Code:
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
    j = LastRow + 1
 
Upvote 0
Once again Fluff,

You are the Fluffiest!

Thanks.

1 other thing I am playing with, I am trying to choose the row with the latest data for a userform that displays the information. The ID for the item may be duplicated, so I need to make the selection only pull the current data defined by a date in row A.

any ideas?
 
Upvote 0
As that's a completely different question, you'd best start a new thread.
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

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