Hi there, I need help please?
I have a Workbook, however the VBA I use to copy columns from sheet "Temp" to "Analyse" does not order them into the correct order on paste. They appear in the order of the "Temp" sheet.
The "Temp" sheet has many more columns that are pasted from a Windows App which is a problem too as I cannot seem to specify the whole "Temp" and "Analyse" sheets type as Text either and I have no control over the order of the columns that they are being copied from. "Temp" is also a hidden sheet. Rows can be anything from a couple to 2000.
There are two Windows sources that are used, hence the rename column headers part added.
I also have a sheet called "Search" with buttons on to make things easier. There is more to the spreadsheet that I have not included, but need assistance optimizing the code. I am using VLOOKUP to populate columns in the "Ananlyse" sheet which I would like to do with VBA instead, but that's for another day.
I did considder INDEX and MATCH, but I need this to be fast due to a Query that runs and updates a table used for the VLOOKUP on opening the Workbook, that is already slow. I tried posting the workbook, but I'm developing on it and there is much that has changed since my inicial request. 1298478-a-combination-spreadsheet-as-database-userform-onsheet-userform-and-vba-to-do-stuff.
So...
I use this at the top of this Module "Utilities" and other code follows for compatibility and similar in other modules for other functions.
The Paste code from Windows clipboard is as follows, it has about 50 columns.
The code I am using to copy from one sheet to the other I found on another thread and adapted, is:
I have included the Rename part that is called during CopyColumns. It's quite rough, and I was busy trying to figure a better method.
"Temp" is a hidden sheet.
For interest, my VLOOKUP is prepopulated in "Analyse" columns H:J from rows 1 to 2000, but shows a message if cells in column D has no value or is not an exact match. I need to figure a way to populate the VLOOKUP using xlUP or something along those lines.
Bookmarks