Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2000/Visual Basic -- I need to learn... | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Creating Toolbar on Word 2000 using built-in Visual Basic Editor | Excel Programming | |||
creating Toolbar on Word 2000 using built-in Visual Basic Editor | Excel Programming | |||
Addin for Excel 2000/97 (In Visual Basic) | Excel Programming |