Forum Discussion
I am trying to copy and paste data from a range of columns VBA
Maybe this is along the lines of what you're looking for (attached)? I'm assuming the headers are unique (if not, it can be modified). It sounds like you may want to add additional fields later on, so you should be able to just add the header captions to the headers array.
- Desno13Dec 31, 2020Copper Contributor
Thanks for this. So yes this is what I want but with some adjustments. I have included the comments in the excel sheet and also a sample of my data.
But thank you for this!
- JMB17Jan 05, 2021Bronze Contributor
Sorry it took me a bit to get back to you. I think I understand better now what you want to do - the columns you want to copy are entirely based on position (relative to the date column).
See attached (Module 1). But, note that I'm making some assumptions about which row the "Date" header will appear in (I'm assuming Row 2, but change if necessary). Also, I'm assuming the macro should run on the active sheet and is copying the data to a new worksheet.