![]() |
Fix column widths in Excel template
Dim varr(1 to 10)
for i = 1 to 10 varr(i) = activesheet.columns(i).Columnwidth Next ' code to import text file for i = 1 to 10 activesheet.columns(i).Columnwidth = varr(i) Next That shouldn't be too tedious. another approach would be to add a (dummy) sheet, import into that sheet, then do and edit copy and go to the target sheet and do an edit pastespecial, values, then delete the dummy sheet -- Regards, Tom Ogilvy "John Garate" wrote in message ... Excel 2002, Win XP, SP-2 I'm trying to create a pre-formatted template that uses a macro to import data from a tab delimited file. I would like to fix the column widths so they do not change during data import. Now, when the data imports, the column widths automatically adjust themselves to fit the data. How can I create a template and fix the column widths so they do not change during data import?. I know I can add the column widths to the macro it self, but since I create many templates, this is tedious. -- John Garate |
All times are GMT +1. The time now is 09:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com