Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Questions
I have a program that is almost done with some bugs I could not seem to fix.
1. Is there a way to save items shown on List 1 (user selection) and List 2 (user selected) after user exits Excel?. My intuition is no since everything is gone from RAM. 2. List 1 items are imported from data which, have superscripts & subscripts but when added to the List 1 formatting is lost which cascades into List 2 and dumping items into a sheet. 3. When I select/deselect items and show form again, List 2 items deselected are duplicated in List 1. For Row = 7 To 27 RXWIon.List1.AddItem Sheets("Database").Cells(Row, 2) Next Row End Sub Private Sub CommandButton1_Click() Dim s As String, i As Integer, it As Control i = List1.ListIndex s = List1.Text If List1.ListIndex < 0 Then Exit Sub If List2.ListCount = 0 Then List2.AddItem s Else p = findpos(s, List2) If p -1 Then List2.AddItem s, p Else List2.AddItem s End If End If List1.RemoveItem i End Sub Private Sub CommandButton2_Click() Dim s As String, i As Integer, it As Control i = List2.ListIndex s = List2.Text If List2.ListIndex < 0 Then Exit Sub If List1.ListCount = 0 Then List1.AddItem s Else p = findpos(s, List1) If p -1 Then List1.AddItem s, p Else List1.AddItem s End If End If List2.RemoveItem i End Sub Private Sub pbCANCEL_Click() ' Me.Hide End Sub Private Sub pbAccept_Click() Dim lbx As MSForms.ListBox Set lbx = Me.List2 With Worksheets("Calcs") .Range("B7").Resize(lbx.ListCount, 1).Value = lbx.List End With Me.Hide. End Sub Thanks. Ligaya |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Questions
1) as you thought You would need to write them to a worksheet and save
the workbook. 2) doesn't support rich text format, so doesn't support super and sub scripts. 3) Your code seemed to work for me. -- Regards, Tom Ogilvy "Ligaya" wrote in message ... I have a program that is almost done with some bugs I could not seem to fix. 1. Is there a way to save items shown on List 1 (user selection) and List 2 (user selected) after user exits Excel?. My intuition is no since everything is gone from RAM. 2. List 1 items are imported from data which, have superscripts & subscripts but when added to the List 1 formatting is lost which cascades into List 2 and dumping items into a sheet. 3. When I select/deselect items and show form again, List 2 items deselected are duplicated in List 1. For Row = 7 To 27 RXWIon.List1.AddItem Sheets("Database").Cells(Row, 2) Next Row End Sub Private Sub CommandButton1_Click() Dim s As String, i As Integer, it As Control i = List1.ListIndex s = List1.Text If List1.ListIndex < 0 Then Exit Sub If List2.ListCount = 0 Then List2.AddItem s Else p = findpos(s, List2) If p -1 Then List2.AddItem s, p Else List2.AddItem s End If End If List1.RemoveItem i End Sub Private Sub CommandButton2_Click() Dim s As String, i As Integer, it As Control i = List2.ListIndex s = List2.Text If List2.ListIndex < 0 Then Exit Sub If List1.ListCount = 0 Then List1.AddItem s Else p = findpos(s, List1) If p -1 Then List1.AddItem s, p Else List1.AddItem s End If End If List2.RemoveItem i End Sub Private Sub pbCANCEL_Click() ' Me.Hide End Sub Private Sub pbAccept_Click() Dim lbx As MSForms.ListBox Set lbx = Me.List2 With Worksheets("Calcs") .Range("B7").Resize(lbx.ListCount, 1).Value = lbx.List End With Me.Hide. End Sub Thanks. Ligaya |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Answers to questions posing more questions in a workbook | Excel Worksheet Functions | |||
View Questions and Answer to questions I created | Excel Discussion (Misc queries) | |||
VBA userform questionS | Excel Discussion (Misc queries) | |||
data entry with userform questions | Excel Programming | |||
newbie with userform questions | Excel Programming |