0

Hi guys Im creating a macro with the macro recorder on excel what I want this macro to do is to take the values from a row in a pivot table and paste it in a list that Im using to track the changes of this pivot table values through time like an entry.

the code the recorder gave was the below one

Range("U19:Y19").Select
Selection.Copy
Range("E18:I18").Select
ActiveSheet.Paste
Range("U20:Y20").Select
Application.CutCopyMode = False
Selection.Copy
Range("N18:R18").Select
ActiveSheet.Paste

As you can see is a simple copy a range of cells and paste it somewhere else however what I want to happen is that every time I run this macro this list gets filled on the next available row so if I run it the first time it pastes the information in E18:I18 and N18:R18 but if I run it the second time it pastes the information in E19:I19 and N19:R19 and so on and so forth on the subsequent rows each time I run the macro, Im starting with this macro thing and Im still catching up with how to write code

Thanks a lot

BigBen
  • 46,229
  • 7
  • 24
  • 40
  • See [this question](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba). – BigBen Nov 08 '19 at 16:39
  • Ok that will help me to find the last row and then how do I paste the information afterwards? Ill use the one to find last row in a table shall I make a separate macro of this code and then call it on the above? – Sergio Florez Nov 08 '19 at 17:46
  • 1
    figure it out with the below: Range("U20:Y20").Copy Range("N515").End(xlUp).Offset(1, 0) – Sergio Florez Nov 13 '19 at 19:14
  • Nice! Looks good. – BigBen Nov 13 '19 at 20:23
  • No Im running the below code, that sdoes exactly the same from another fields of the pivot to another table, everthing on the same worksheet, the first works, the second doesnt – Sergio Florez Nov 14 '19 at 16:40
  • my code is this: Sub AiSLogCompletedCR() ' AiSLogCompletedCR ' AiS Status log entry for CR's on Completed Status Range("U19:Y19").Copy Range("E515").End(xlUp).Offset(1, 0) End Sub Sub AiSLoginflightCR() ' AiSLoginflightCR ' AiS Status log entry for CR's on Completed Status Range("U20:Y20").Copy Range("N515").End(xlUp).Offset(3, 0) End Sub – Sergio Florez Nov 14 '19 at 16:42
  • If you have a new issue, please ask a new question, thanks! – BigBen Nov 14 '19 at 16:42

0 Answers0