![]() |
Userform - with Commandbutton fill a Listbox with data..
Hi all,
I would like to ask your help for my challange :) Scope: I have 15 sheets, on every sheet there are 3 colunms (A, B and C) filled with data..(the number of rows do differ) Question: On a 'Userform' I have made 15 commandbuttons and 1 'Listbox' without input field.. This is what I would like to do: When CommandButton1 is clicked, I want the data (from page 1) to be shown in the Listbox.. etc. so.. When commandbutton2 is clicked, I want the data (from page 2) to be shown in the Listbox.. When commandbutton3 is clicked, I want the data (from page 3) to be shown in the Listbox.. ... When CommandButton15 is clicked, I want the data (from page 15) to be shown in the Listbox.. How can I do this with VBA? are there expamples? So I can see how I can do it? thnx! for your help.. Arjan the Netherlands |
Userform - with Commandbutton fill a Listbox with data..
Private Sub CommandButton1_Click()
Dim rng as Range With Worksheets("Sheet1") set rng = .Range("A1").Currentregion.Resize(,3) ' if you don't want the first row uncomment the next line ' set rng = rng.offset(1,0).Resize(rng.rows.count-1,3) End With ListBox1.ColumnCount = 3 ListBox1.List = rng.value End With Repeat for each button. -- Regards, Tom Ogilvy "Arjan" wrote in message ... Hi all, I would like to ask your help for my challange :) Scope: I have 15 sheets, on every sheet there are 3 colunms (A, B and C) filled with data..(the number of rows do differ) Question: On a 'Userform' I have made 15 commandbuttons and 1 'Listbox' without input field.. This is what I would like to do: When CommandButton1 is clicked, I want the data (from page 1) to be shown in the Listbox.. etc. so.. When commandbutton2 is clicked, I want the data (from page 2) to be shown in the Listbox.. When commandbutton3 is clicked, I want the data (from page 3) to be shown in the Listbox.. .. When CommandButton15 is clicked, I want the data (from page 15) to be shown in the Listbox.. How can I do this with VBA? are there expamples? So I can see how I can do it? thnx! for your help.. Arjan the Netherlands |
All times are GMT +1. The time now is 06:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com