Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Copy to next empty row is not working

  1. #1
    Board Regular
    Join Date
    Mar 2010
    Location
    New England
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Copy to next empty row is not working

    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 by DThib; Apr 23rd, 2019 at 09:23 AM.

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    21,803
    Post Thanks / Like
    Mentioned
    357 Post(s)
    Tagged
    36 Thread(s)

    Default Re: Copy to next empty row is not working

    Try
    Code:
    LastRow = Cells(Rows.Count, "B").End(xlUp).Row
        j = LastRow + 1
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

  3. #3
    Board Regular
    Join Date
    Mar 2010
    Location
    New England
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Copy to next empty row is not working

    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?

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    21,803
    Post Thanks / Like
    Mentioned
    357 Post(s)
    Tagged
    36 Thread(s)

    Default Re: Copy to next empty row is not working

    As that's a completely different question, you'd best start a new thread.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •