I'm trying to display a worksheet on a form, but until now i did not succeed. The worksheet it contain 15 columns and about 2000 rows. Can someone help me?
Build a form with a listbox on it, and also a button. Then put this code into the form module. The button should have the name CommandButton1 and the listbox should be named ListBox1.
Finally on the listbox control change the columncount to 15.
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
' Activate the sheet that has the data you want displayed in the listbox
Sheet1.Activate
' Put the range of the data you want displayed.
' Here I used columns "A" to "O" and 2000 rows
ListBox1.RowSource = "A1:O2000"
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.