Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
[Excel 2003]
I use listboxes to display tables of data. Is there a way to adjust individual column widths such that one can make the columns fit - some of my columns need to be narrow and some wide. Thus far I have only been able to make the first column width adjusted (ColumnWidth Property) to what i want, but the others seem to be set to a predefined default width. Surely one can use code to adjust all the widths?? Roger |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To manually adjust the columns of a listbox in the properties window, if you
have three columns: ColumnWidth | 20, 40, 25 Would set column 1 to 20, col 2 to 40 and col 3 to 25 "Roger on Excel" wrote in message ... [Excel 2003] I use listboxes to display tables of data. Is there a way to adjust individual column widths such that one can make the columns fit - some of my columns need to be narrow and some wide. Thus far I have only been able to make the first column width adjusted (ColumnWidth Property) to what i want, but the others seem to be set to a predefined default width. Surely one can use code to adjust all the widths?? Roger |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That should be delimited by semicolons, not commas.
20; 40; 25 In Code: UserForm1.Listbox1.ColumnWidths = 20; 40; 25 The default measurement is in points. You have to specify if you want to use inches. See VBA help for details. "JLGWhiz" wrote in message ... To manually adjust the columns of a listbox in the properties window, if you have three columns: ColumnWidth | 20, 40, 25 Would set column 1 to 20, col 2 to 40 and col 3 to 25 "Roger on Excel" wrote in message ... [Excel 2003] I use listboxes to display tables of data. Is there a way to adjust individual column widths such that one can make the columns fit - some of my columns need to be narrow and some wide. Thus far I have only been able to make the first column width adjusted (ColumnWidth Property) to what i want, but the others seem to be set to a predefined default width. Surely one can use code to adjust all the widths?? Roger |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 28 Nov 2009 16:30:01 -0800, Roger on Excel
wrote: [Excel 2003] I use listboxes to display tables of data. Is there a way to adjust individual column widths such that one can make the columns fit - some of my columns need to be narrow and some wide. Thus far I have only been able to make the first column width adjusted (ColumnWidth Property) to what i want, but the others seem to be set to a predefined default width. Surely one can use code to adjust all the widths?? Roger Set up the sheet you wish to have column widths copied from, and select the top row, or only those cells you wish to copy the column widths of. Copy then paste special in the sheet you want with "column widths" as what you are copying. That is the hand mode. The recorded code I got was: Sub ColumnAtribCopy() ' ' Meant to copy column widths from current ' sheet to specified sheet ' (currently sheet2) Rows("1:1").Select Selection.Copy ' target sheet name can be specified below Sheets("Sheet2").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Range("A1").Select End Sub Replace "sheet2" with your sheet name, of course, and re-connect broken lines due to Usenet concatenation (fourth line up). |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The widths shoulb be a string data type:
UserForm1.Listbox1.ColumnWidths = "20; 40; 25" Just add quote marks. "JLGWhiz" wrote in message ... To manually adjust the columns of a listbox in the properties window, if you have three columns: ColumnWidth | 20, 40, 25 Would set column 1 to 20, col 2 to 40 and col 3 to 25 "Roger on Excel" wrote in message ... [Excel 2003] I use listboxes to display tables of data. Is there a way to adjust individual column widths such that one can make the columns fit - some of my columns need to be narrow and some wide. Thus far I have only been able to make the first column width adjusted (ColumnWidth Property) to what i want, but the others seem to be set to a predefined default width. Surely one can use code to adjust all the widths?? Roger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
auto adjust column widths and row height | Excel Discussion (Misc queries) | |||
AUTOMATICALLY ADJUST COLUMN WIDTHS TO CONTENT | Excel Worksheet Functions | |||
Automatically adjust column widths | Excel Discussion (Misc queries) | |||
Column widths to adjust automatically? | Excel Discussion (Misc queries) | |||
How do I adjust column widths only on selected cells? | Excel Discussion (Misc queries) |