N
Norm Lundquist
I am having a problem setting the height of a listbox.
I have a userform with a listbox containing all range names of the workbook.
Below this listbox are two command buttons. I want to show all range names
(usually a number between 3 and 6), so I set the height of the listbox, then
set the "Top" of the two command buttons, and then set the height of the
userform.
The following code is in the Initialize event of the userform:
ListBox1.Height = Count * 12 + 2
cmdPrint.Top = 96 + ListBox1.Height + 16
cmdClose.Top = 96 + ListBox1.Height + 16
uflPrtRng.Height = 96 + ListBox1.Height + 16 + cmdClose.Height + 16 + 20
This sets the top of the buttons to be 16 points below the bottom of the
listbox. (At least that's what I was hoping it would do!)
The trouble is that the first line seems to be ignored! If Count = 6 then
the height should be 74. I'll run the code and the height is 49.2!! Then
I'll step thru the code and the height is set to 74 and the form looks good.
I'll run the code again without stepping thru it and it's back to 49.2.
The listbox is not locked and it's initial height in design mode is 50.
Is there some other property that I don't have set correctly??
Thank You!
I have a userform with a listbox containing all range names of the workbook.
Below this listbox are two command buttons. I want to show all range names
(usually a number between 3 and 6), so I set the height of the listbox, then
set the "Top" of the two command buttons, and then set the height of the
userform.
The following code is in the Initialize event of the userform:
ListBox1.Height = Count * 12 + 2
cmdPrint.Top = 96 + ListBox1.Height + 16
cmdClose.Top = 96 + ListBox1.Height + 16
uflPrtRng.Height = 96 + ListBox1.Height + 16 + cmdClose.Height + 16 + 20
This sets the top of the buttons to be 16 points below the bottom of the
listbox. (At least that's what I was hoping it would do!)
The trouble is that the first line seems to be ignored! If Count = 6 then
the height should be 74. I'll run the code and the height is 49.2!! Then
I'll step thru the code and the height is set to 74 and the form looks good.
I'll run the code again without stepping thru it and it's back to 49.2.
The listbox is not locked and it's initial height in design mode is 50.
Is there some other property that I don't have set correctly??
Thank You!