Copy command within a macro

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,
I built a macro to copy data from a worksheet tab to another tab. The size of the data file varies so bult the macro like this but it still only picks up the original ranges, always the same range. Can anyone help??

Range("A4").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("O.data").Select
Range("B132057").Select
ActiveSheet.Paste

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Code seems to be correct. There might be white spaces so xldown and xltoright are selecting the cells that you dont want to select as they contain white spaces

Could you please upload a sample file with sample data etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , etc and post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too