98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Manipulate Excel worksheet columns from Access | Access forum
Manipulate Excel worksheet columns from Access | Access forum
Resolved · High Priority · Version 2010
Andrew has attended:
Access Advanced course
Excel VBA Intro Intermediate course
Excel Intermediate course
Excel VBA Intro Intermediate course
Manipulate Excel worksheet columns from Access
I am importing data from an Excel workbook into an Access table. A straight import works fine. Because of new requirements I now need to swap the worksheet columns around prior to import. i.e. column E needs to be in column A, A needs to be in H, B needs to be in F etc., etc. before the import can take place.(I have to leave the Access import routine as standard.) I am trying to grab a column at a time and write it to a new worksheet in its required column position. I have tried different techniques that I downloaded from various forums but they don't work. Is there actually a way of doing this without having to process a cell at a time ? (It has to done from within the Access form/code without the user being aware of the processing). I would be very grateful for any advice. Thanks.
RE: manipulate Excel worksheet columns from Access
Hi Andrew
Thanks for getting in touch. There's a few methods you could use, but arguably the simplest would involve recording. You could record cutting a column and pasting it into it's new location. You'll get code like this:
Columns("B:B").Select
Selection.Cut
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Once you have recorded the process you can work on optimising it to speed it up. So the above would become:
Columns("B:B").Cut
Columns("D:D").Insert Shift:=xlToRight
Kind regards
Gary Fenn
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Changing MS Programs Text SizeA handy way to increase or decrease the size of text in Microsoft Word, Microsoft PowerPoint, Microsoft FrontPage, or Microsoft Publisher, first, select the text you want to resize. |