karentx09
New Member
- Joined
- Feb 9, 2023
- Messages
- 4
- Office Version
- 365
- 2021
- 2019
- 2016
- Platform
- Windows
Hi y'all!
The range I am referencing changes length because it is in a pivot table. What I did in the macro recording was clicked cell M4, control+down and then shift+up (since the last cell is the total and I don't need that). This is the code it spits out:
Range("M4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("M4:M30").Select
Selection.Copy
However, since the range will vary from month to month, I do not want it to only reference M4:M30; I would really like to rely on the key strokes. This issue flows throughout my macros, so looking to implement multiple places, but this is simply the start. Thank you in advance for your help!
The range I am referencing changes length because it is in a pivot table. What I did in the macro recording was clicked cell M4, control+down and then shift+up (since the last cell is the total and I don't need that). This is the code it spits out:
Range("M4").Select
Range(Selection, Selection.End(xlDown)).Select
Range("M4:M30").Select
Selection.Copy
However, since the range will vary from month to month, I do not want it to only reference M4:M30; I would really like to rely on the key strokes. This issue flows throughout my macros, so looking to implement multiple places, but this is simply the start. Thank you in advance for your help!