Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a Listbox with mult. Variables in userform Jennifer Excel Programming 2 May 23rd 06 07:28 PM
Fill listbox with data from file text Pavu Excel Programming 1 April 6th 06 01:58 PM
Filtering data to a userform listbox Kryer Excel Programming 1 October 3rd 05 10:25 AM
CommandButton - Userform Marcia3641 Excel Discussion (Misc queries) 2 July 21st 05 06:39 PM
Fill a listbox with data from variable range Al Excel Programming 2 August 10th 04 07:05 AM


All times are GMT +1. The time now is 11:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"