Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default listbox.Columnwidths question

The following statement does not appear to have
effect:

Private Sub frmName_Contractors_Initialize()
lbDataCode.Width = 100
lbDataCode.ColumnCount = 2
lbDataCode.ColumnWidths = "6;94"
End Sub

I've changed the overall width.....increasing it
I've narrowed column1 and widened 2.
Columnwidths are not set in the listbox object.

Why are the changes not being seen in the form,
please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default listbox.Columnwidths question

open a new workbook.

Add a userform.

Useform1
textbox1 textbox2 textbox3

listbox1

put three textboxes above the listbox. Make the userform significantly
wider than the listbox

Put in the following code

Private Sub TextBox1_Change()
ListBox1.Width = CLng(TextBox1.Value)
End Sub

Private Sub TextBox2_Change()
ListBox1.ColumnWidths = Trim(TextBox2.Value) & ";" & Trim(TextBox3.Value)
End Sub

Private Sub TextBox3_Change()
ListBox1.ColumnWidths = Trim(TextBox2.Value) & ";" & Trim(TextBox3.Value)
End Sub

Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 2
For i = 1 To 10
With ListBox1
.AddItem "AAAAAAAAAAAAAAAAAAAAAAAAA"
.List(.ListCount - 1, 1) = "BBBBBBBBBBBBBBBBBBBBBBBBB"
End With
Next
End Sub

Put in a width for the listbox in textbox1. Then put in a width for column
1 in textbox2 and a width for column 2 in textbox3.

play with the settings by changing the values in the textboxes.

Anyway, worked fine for me.

--
Regards,
Tom Ogilvy



Stuart wrote in message
...
The following statement does not appear to have
effect:

Private Sub frmName_Contractors_Initialize()
lbDataCode.Width = 100
lbDataCode.ColumnCount = 2
lbDataCode.ColumnWidths = "6;94"
End Sub

I've changed the overall width.....increasing it
I've narrowed column1 and widened 2.
Columnwidths are not set in the listbox object.

Why are the changes not being seen in the form,
please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox Question LearningExcel Excel Worksheet Functions 0 December 30th 05 05:46 PM
Listbox Question Greg B Excel Worksheet Functions 1 March 9th 05 02:17 PM
listbox question Larry Levinson[_2_] Excel Programming 1 September 6th 03 11:43 PM
Paste columnwidths in Xl2k problem Stuart[_5_] Excel Programming 3 September 4th 03 05:09 PM
Listbox question Stuart[_5_] Excel Programming 1 August 21st 03 07:16 PM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"