Copy and Pastspecial only copying 5 rows of data

AskMyDog

New Member
Joined
Nov 13, 2015
Messages
16
Hi,

I've ben pulling my hair out trying to figure out this simple code. It's supposed to copy values and formatting only from selected rows from a table in one worksheet to another worksheet, removing blanks and duplicates . I've tried multiple ways, which either work and then stop working, or not work at all (notably, the range(.sheets.rows.count).end(xlup) method stops at the end of the table, before it gets to the last line of code).

The current code below only copies the first 5 or 6 rows of data, and I can't figure out why.

Please help!



Option Explicit

Sub CopyPasteMeds()


Worksheets("Reconcile Meds Here").Range("C6", Worksheets("Reconcile Meds Here").Range("L6").End(xlDown)).ClearContents


Worksheets("paste meds here").Range("m6", "t40").Copy

Worksheets("Reconcile Meds Here").Range("C6").PasteSpecial , Paste:=xlPasteValuesAndNumberFormats, skipblanks:=True


Worksheets("Reconcile Meds Here").Range("C6", "L40").RemoveDuplicates Columns:=3, Header:=xlNo


Worksheets("Reconcile Meds Here").Activate


End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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