Code will not copy full list

Frankietheflyer

New Member
Joined
Nov 17, 2017
Messages
29
Hi

The Code below looks at a dynamic list of information in a worksheet "Teams & Runners Data Form Entry" and should copy all the information in Columns B:E and paste it into the sheet "Team List" columns A:D.

However! It currently only copies 10 of the 18 rows in the "Teams & Runners Data Form Entry" sheet (11 counting the header). Column B in the "Teams & Runners Data Form Entry" sheet is full with no blanks although columns D and E do have some blank cells in them but never in both together on the same row.

I've run a "=COUNTA(B:B)" in the "Teams & Runners Data Form Entry" sheet and it comes up with a count of 18.

An ideas why the code is not copying the last few rows please?


<strike>
</strike>
Code:
[FONT=Verdana]Sub LoadTeamList()[/FONT]
[FONT=Verdana]Application.ScreenUpdating = False[/FONT]
[FONT=Verdana]Dim wb As Workbook
Dim Found As Range[/FONT]
[FONT=Verdana]With Sheets("Team List")[/FONT]
[FONT=Verdana].Range("A:D").ClearContents[/FONT]
[FONT=Verdana]    Set destRng = .Range("A" & .Cells(.Rows.Count, "A").End(xlUp).Row)
    
LastRow = Sheets("Teams & Runners Data Form Entry").Range("B1:B" & Rows.Count).End(xlUp).Row
    Sheets("Teams & Runners Data Form Entry").Range("B1:E1" & LastRow).Copy Destination:=destRng
    
        .Columns("A:D").AutoFit
        
     Application.ScreenUpdating = True
     
     End With[/FONT]
[FONT=Verdana]End Sub
[/FONT]


Thanks

Frankie
 
Last edited:

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
45,141
Office Version
365
Platform
Windows
First, your code clears columns A:D in 'Team List' so that code you have to set destRng will always be A1 so that line would be simpler as
Code:
Set destRng = .Range("A1")
In relation to your problem, try making these two changes to your code.

Code:
<del>LastRow = Sheets("Teams & Runners Data Form Entry").Range("B1:B" & Rows.Count).End(xlUp).Row</del>
LastRow = Sheets("Teams & Runners Data Form Entry").Range("B" & Rows.Count).End(xlUp).Row
<del>Sheets("Teams & Runners Data Form Entry").Range("B1:E1" & LastRow).Copy Destination:=destRng</del>
Sheets("Teams & Runners Data Form Entry").Range("B1:E" & LastRow).Copy Destination:=destRng
 

Watch MrExcel Video

Forum statistics

Threads
1,102,162
Messages
5,485,113
Members
407,481
Latest member
junniec

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top