Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel 2000 Visual Basic - Export Contents of ListBox into a worksh

Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 Visual Basic - Export Contents of ListBox into a worksh

I am not quite sure what you are trying to do, but this code will spit the
items in a listbox into a worksheet:

Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBoxX.ListCount - 1
With ActiveCell
.Value = ListBoxX.List(i)
.Offset(1, 0).Select
End With
Next i
End Sub

You will need to rename ListBoxX according to thae name that you are using.
You also need to identify the Workcheet and Cell address for the ActiveCell
refenence.

Hope this helps

Alasdair Stirling

"Ligaya" wrote:

Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2000 Visual Basic - Export Contents of ListBox into a worksh

Your question is pretty vague. Assume a multiselect listbox on a userform
or on a worksheet and a commandbutton triggers the action.

Private Sub Commandbutton1_Click()
Dim j as Long, i as long
j = 1
for i = 0 to me.listbox1.Listcount - 1
if me.listbox1.selected(i) then
Worksheets(1).cells(j,1).Value = me.listbox1.List(i)
j = j + 1
End if
Next
End Sub

perhaps the above will give you some ideas.
--
Regards,
Tom Ogilvy

"Ligaya" wrote in message
...
Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel 2000 Visual Basic - Export Contents of ListBox into a wo



"Alasdair Stirling" wrote:

I am not quite sure what you are trying to do, but this code will spit the
items in a listbox into a worksheet:

Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBoxX.ListCount - 1
With ActiveCell
.Value = ListBoxX.List(i)
.Offset(1, 0).Select
End With
Next i
End Sub

You will need to rename ListBoxX according to thae name that you are using.
You also need to identify the Workcheet and Cell address for the ActiveCell
refenence.

Hope this helps

Alasdair Stirling

"Ligaya" wrote:

Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya


You got what I want to do with the 2nd List Box.

Thanks.

Ligaya


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel 2000 Visual Basic - Export Contents of ListBox into a wo



"Tom Ogilvy" wrote:

Your question is pretty vague. Assume a multiselect listbox on a userform
or on a worksheet and a commandbutton triggers the action.

Private Sub Commandbutton1_Click()
Dim j as Long, i as long
j = 1
for i = 0 to me.listbox1.Listcount - 1
if me.listbox1.selected(i) then
Worksheets(1).cells(j,1).Value = me.listbox1.List(i)
j = j + 1
End if
Next
End Sub

perhaps the above will give you some ideas.
--
Regards,
Tom Ogilvy

"Ligaya" wrote in message
...
Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel 2000 Visual Basic - Export Contents of ListBox into a wo



"Tom Ogilvy" wrote:

Your question is pretty vague. Assume a multiselect listbox on a userform
or on a worksheet and a commandbutton triggers the action.

Private Sub Commandbutton1_Click()
Dim j as Long, i as long
j = 1
for i = 0 to me.listbox1.Listcount - 1
if me.listbox1.selected(i) then
Worksheets(1).cells(j,1).Value = me.listbox1.List(i)
j = j + 1
End if
Next
End Sub

perhaps the above will give you some ideas.
--
Regards,
Tom Ogilvy

"Ligaya" wrote in message
...
Hi,

I developed 2 list boxes and succesfully added items to the first ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way to
place the items from ListBox to into another worksheet within the same
workbook.

Thanks.

Ligaya



Thanks. I was responding to an OptionButton (same finction in my program
as CommandButton).

Ligaya
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2000 Visual Basic - Export Contents of ListBox into a wo

Well, if you want everything in listbox2 listed in column A, starting in row
1

Private Sub OptionButton1_click()
Dim lbx as MSForms.Listbox
set lbx = me.Listbox2
if me.optionButton1.Value then
with worksheets(1)
.Range("A1").Resize(lbx.listcount,1).Value = _
lbx.List
end with
End if
End sub

--
Regards,
Tom Ogilvy


"Ligaya" wrote in message
...


"Tom Ogilvy" wrote:

Your question is pretty vague. Assume a multiselect listbox on a

userform
or on a worksheet and a commandbutton triggers the action.

Private Sub Commandbutton1_Click()
Dim j as Long, i as long
j = 1
for i = 0 to me.listbox1.Listcount - 1
if me.listbox1.selected(i) then
Worksheets(1).cells(j,1).Value = me.listbox1.List(i)
j = j + 1
End if
Next
End Sub

perhaps the above will give you some ideas.
--
Regards,
Tom Ogilvy

"Ligaya" wrote in message
...
Hi,

I developed 2 list boxes and succesfully added items to the first

ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way

to
place the items from ListBox to into another worksheet within the

same
workbook.

Thanks.

Ligaya



Thanks. I was responding to an OptionButton (same finction in my program
as CommandButton).

Ligaya



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Excel 2000 Visual Basic - Export Contents of ListBox into a wo



"Tom Ogilvy" wrote:

Well, if you want everything in listbox2 listed in column A, starting in row
1

Private Sub OptionButton1_click()
Dim lbx as MSForms.Listbox
set lbx = me.Listbox2
if me.optionButton1.Value then
with worksheets(1)
.Range("A1").Resize(lbx.listcount,1).Value = _
lbx.List
end with
End if
End sub

--
Regards,
Tom Ogilvy


"Ligaya" wrote in message
...


"Tom Ogilvy" wrote:

Your question is pretty vague. Assume a multiselect listbox on a

userform
or on a worksheet and a commandbutton triggers the action.

Private Sub Commandbutton1_Click()
Dim j as Long, i as long
j = 1
for i = 0 to me.listbox1.Listcount - 1
if me.listbox1.selected(i) then
Worksheets(1).cells(j,1).Value = me.listbox1.List(i)
j = j + 1
End if
Next
End Sub

perhaps the above will give you some ideas.
--
Regards,
Tom Ogilvy

"Ligaya" wrote in message
...
Hi,

I developed 2 list boxes and succesfully added items to the first

ListBox.
I then selected items from ListBox1 to ListBox2. What is the best way

to
place the items from ListBox to into another worksheet within the

same
workbook.

Thanks.

Ligaya


Thanks. I was responding to an OptionButton (same finction in my program
as CommandButton).

Ligaya



Thanks. It worked like a charm. I was dumping the contents of the ListBox
into a range in the worksheet.

Ligaya
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
Excel 2000/Visual Basic -- I need to learn... CMIConnie Excel Discussion (Misc queries) 4 July 10th 06 07:26 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Creating Toolbar on Word 2000 using built-in Visual Basic Editor Sagar Gadre Excel Programming 1 September 10th 04 02:19 PM
creating Toolbar on Word 2000 using built-in Visual Basic Editor sagarsehwag Excel Programming 0 August 22nd 04 02:22 PM
Addin for Excel 2000/97 (In Visual Basic) Jason Sholar Excel Programming 3 January 29th 04 01:52 PM


All times are GMT +1. The time now is 03:03 AM.

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"