Hi all,
I have an interesting challenge where I am just returning to the world of Excel after a break of nearly 20 years and I'm jumping straight into VBA, my challenge is all based around how to simplify a process of consolidating over 70 worksheets (in the same workbook) of information into one sheet (keeping it long and narrow)
Since the end user has control over their individual sheet there are variances in the headers, one may call a header Compliance, others Compliant etc, as well as the order of headers.
Instantly that is a large scope of works and I've done some research and my original macro was very simple but effective and then I discovered the flaw in my logic
I had the code repeat for all 70 pages, while rough it did the job. However the flaw which unravelled my logic and as a result the request for assistance.
The columns in the Datapages are not in a set order. One of the critical elements may be in column C in one page, and E on another.
Is there a way to simplify my macro to enable:
Appreciate any help that can be offered.
Thanks in advance
I have an interesting challenge where I am just returning to the world of Excel after a break of nearly 20 years and I'm jumping straight into VBA, my challenge is all based around how to simplify a process of consolidating over 70 worksheets (in the same workbook) of information into one sheet (keeping it long and narrow)
Since the end user has control over their individual sheet there are variances in the headers, one may call a header Compliance, others Compliant etc, as well as the order of headers.
Instantly that is a large scope of works and I've done some research and my original macro was very simple but effective and then I discovered the flaw in my logic
VBA Code:
Sheets("Datapage1").Range("b2:b2").Copy Destination:=Sheets("Sheet1").Range("a2:a500")
Sheets("Datapage1").Range("A9:d500").Copy Destination:=Sheets("Sheet1").Range("b1")
I had the code repeat for all 70 pages, while rough it did the job. However the flaw which unravelled my logic and as a result the request for assistance.
The columns in the Datapages are not in a set order. One of the critical elements may be in column C in one page, and E on another.
Is there a way to simplify my macro to enable:
- Copy column if the header contains "compli" (non case sensitive) within a range of cells C9:F11 for example into "Sheet1"
- I know how annoying it is that the headers are not actually headers
- Read all worksheets as opposed to writing a line (or several) for each worksheet
Appreciate any help that can be offered.
Thanks in advance