Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Fill a Listbox with mult. Variables in userform | Excel Programming | |||
Fill listbox with data from file text | Excel Programming | |||
Filtering data to a userform listbox | Excel Programming | |||
CommandButton - Userform | Excel Discussion (Misc queries) | |||
Fill a listbox with data from variable range | Excel Programming |