why the value are out the header...

S

sal21

In effect when the userform initialize i would want to show into firs
line of listbox1 the 6 value from the sheet named CODICI range S1:X
with a little tipical border...
Have maked this but the value are out respect the first line...
Help me!

With Me.ListBox1
.Clear
.ColumnCount = 6
.ColumnHeads = True
.AddItem
For I = 0 To 5
.List(0, 0 + I) = Sheets("CODICI").Cells(1, 19 + I).Value
Next I
End With

see the image attached..

+-------------------------------------------------------------------
|Filename: listbox.jpg
|Download: http://www.excelforum.com/attachment.php?postid=4287
+-------------------------------------------------------------------
 
T

Tom Ogilvy

ColumnHeads are supported only if you use the rowsource (userform) or
listfillrange (worksheet) properties to load your listbox.

If you do it that way, the column headings are obtained from the row above
the range you bind to/define as the data source.
 
S

sal21

Tom said:
ColumnHeads are supported only if you use the rowsource (userform) or
listfillrange (worksheet) properties to load your listbox.

If you do it that way, the column headings are obtained from the ro
above
the range you bind to/define as the data source.

--
Regards,
Tom Ogilvy

sal21 said:
In effect when the userform initialize i would want to show int first
line of listbox1 the 6 value from the sheet named CODICI range S1:X1
with a little tipical border...
Have maked this but the value are out respect the first line...
Help me!

With Me.ListBox1
Clear
ColumnCount = 6
ColumnHeads = True
AddItem
For I = 0 To 5
List(0, 0 + I) = Sheets("CODICI").Cells(1, 19 + I).Value
Next I
End With

see the image attached...


+-------------------------------------------------------------------+
|Filename: listbox.jpg |
|Download: http://www.excelforum.com/attachment.php?postid=4287 |

+-------------------------------------------------------------------+


Hi Tom, tks for note and suggestion....
Not completly understand...
Attached a little file with the userform in question, if you have
time;-)
If this not is possible sure use other way..

+-------------------------------------------------------------------
|Filename: CONTROLLI_EE.zip
|Download: http://www.excelforum.com/attachment.php?postid=4294
+-------------------------------------------------------------------
 
T

Tom Ogilvy

summary: You can't use them the way you are loading the Listbox.

Here is Microsoft's Explanation - perhaps that will be clearer:

http://support.microsoft.com/kb/211899/en-us
XL2000: Problems Setting Column Headings in ListBox Control

Even thought he article says XL2000, it is applicable to xl97 and later.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top