Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to set column widths in a worksheet
Hi,
I've tried to create a macro that will go in and set the column widths (columns A thru M) to specific widths. Each column is a different width. I used the record button and set them as I wanted and then stopped the recording. When I went to another worksheet in the same workbook and executed I could see it change the width for a split second and then they each went to a standard 7.71 width. No error messages. No explanations. My goal is a macro to be able to import or copy a page from 5 different worksheets that I receive twice a month and be able to view, print and extract data from them for other reports. Thanks in advance, Phil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to set column widths in a worksheet
Without seeing the code, it is impossible to determine what happened.
However, column width is a function of format and many things affect the format of cells, columns and rows such as copying from one sheet to another or from one workbook to another. If you are running SQL, it could have code that affects format, although rarely so. Your sheet could have had an event code in it that reset the column width. As I said, there are many things that could happen after the column width and/or row height is set that might cause them to change to default or other preset sizes. If you want the best assistance, post the relevant code so everone can see it. "Phil Bracken" wrote in message ... Hi, I've tried to create a macro that will go in and set the column widths (columns A thru M) to specific widths. Each column is a different width. I used the record button and set them as I wanted and then stopped the recording. When I went to another worksheet in the same workbook and executed I could see it change the width for a split second and then they each went to a standard 7.71 width. No error messages. No explanations. My goal is a macro to be able to import or copy a page from 5 different worksheets that I receive twice a month and be able to view, print and extract data from them for other reports. Thanks in advance, Phil |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to set column widths in a worksheet
P.S. You might consider running your column width macro after you have
imported data from other workbooks. That would prevent the import process from changing the format. "Phil Bracken" wrote in message ... Hi, I've tried to create a macro that will go in and set the column widths (columns A thru M) to specific widths. Each column is a different width. I used the record button and set them as I wanted and then stopped the recording. When I went to another worksheet in the same workbook and executed I could see it change the width for a split second and then they each went to a standard 7.71 width. No error messages. No explanations. My goal is a macro to be able to import or copy a page from 5 different worksheets that I receive twice a month and be able to view, print and extract data from them for other reports. Thanks in advance, Phil |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to set column widths in a worksheet
On Tue, 14 Jul 2009 16:32:55 -0400, Phil Bracken wrote:
Hi, I've tried to create a macro that will go in and set the column widths (columns A thru M) to specific widths. Each column is a different width. I used the record button and set them as I wanted and then stopped the recording. When I went to another worksheet in the same workbook and executed I could see it change the width for a split second and then they each went to a standard 7.71 width. No error messages. No explanations. My goal is a macro to be able to import or copy a page from 5 different worksheets that I receive twice a month and be able to view, print and extract data from them for other reports. Thanks in advance, Phil Sounds strange. Not just that they went back to standard width, but the standard width you mention is not "Standard". Standard column width in XL, for as long as I can remember (late 80's) is 8.43 points. I would redo the macro, and this time, set the column widths for all sheets, not just the first. See if that helps. Which still doesn't address the issue of why they went back. ?? Maybe someone else has run across this glitch. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to set column widths in a worksheet
I've checked and must have deleted the file I was trying to work from.
it was a workbook that had been previously set up by someone else. It was designed to be printed and then filled in by personnel monitoring some helium purification equipment. There were merged cells but no formulas or data entered on it yet. This was basically practice so that I could perhaps set up a macro to go in and set column widths in worksheets that I receive twice a month from our blimp operations. The guys in the field have "tweaked" their worksheets for their printers, added client logos at the top of the form and other minor changes. What I want to be able to do is collect these worksheets in a folder or a master workbook and then be able to pull data from each one into a summary. I realize I can pull data from worksheets without worrying about the column widths but when they are printed and you thumb through them, it looks terrible. I guess I was just going to tidy it up a bit. I created a new workbook, increased the number of worksheets for what I needed and recreated the macro. it worked flawlessly! Which now brings to mind, how can I be sure that a macro will run on worksheets from 5 different operators? They were originally all created from one master workbook but over the years have been passed from one mechanic to another. They have not been altered radiucally, at least to the eye, but if that relatively simple macro wouoldn't run on a "empty" worksheet, what will it do with one that has data in the cells? Thanks again! Phil On Tue, 14 Jul 2009 16:58:54 -0400, "JLGWhiz" wrote: Without seeing the code, it is impossible to determine what happened. However, column width is a function of format and many things affect the format of cells, columns and rows such as copying from one sheet to another or from one workbook to another. If you are running SQL, it could have code that affects format, although rarely so. Your sheet could have had an event code in it that reset the column width. As I said, there are many things that could happen after the column width and/or row height is set that might cause them to change to default or other preset sizes. If you want the best assistance, post the relevant code so everone can see it. "Phil Bracken" wrote in message .. . Hi, I've tried to create a macro that will go in and set the column widths (columns A thru M) to specific widths. Each column is a different width. I used the record button and set them as I wanted and then stopped the recording. When I went to another worksheet in the same workbook and executed I could see it change the width for a split second and then they each went to a standard 7.71 width. No error messages. No explanations. My goal is a macro to be able to import or copy a page from 5 different worksheets that I receive twice a month and be able to view, print and extract data from them for other reports. Thanks in advance, Phil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet Column Widths Different For Different Users | Excel Discussion (Misc queries) | |||
Different column widths within one worksheet | Excel Discussion (Misc queries) | |||
Set different column widths on two halves of an Exc worksheet | Excel Discussion (Misc queries) | |||
Are different column widths possible on the same worksheet? | Excel Worksheet Functions | |||
Can I have different column widths in a worksheet? | Excel Worksheet Functions |