Set form's listbox ColumnWidths before loading rows

drag1c

Board Regular
Joined
Aug 7, 2019
Messages
97
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi,

I am using two forms:
1.
1699437511679.png


2. 2nd form has listbox in it with combobox and textbox.
1699437547691.png


When I use 1st form and press button "Change", it opens 2nd form and loads data inside but .columnwidths is not as supposed to be.
Where I should write code to load .columnwidths before data is loaded inside listbox ?

I've tried UserForm_Initialize() in Form2, but it didn't work.
I've tried to use Button_Click() Event also with code inside and it didn't work.
I've tried to use UserForm_Activate() in Form2, but it didn't work.

Of course, If I load Form2 and start manually input data, .columnwidths is good.

Here is example how it looks when I open Form2 via Form1:
1699437742474.png


Does anyone have solution?
 

Attachments

  • 1699437532810.png
    1699437532810.png
    4.9 KB · Views: 11

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I've solved it.

I've used vbTab instead to put material in 2nd column, as list(i,1)

Topic can be closed.
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top