Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
VBA userform questionS [email protected] Excel Discussion (Misc queries) 1 February 20th 08 12:07 PM
data entry with userform questions mbernardi Excel Programming 0 September 24th 04 02:06 AM
newbie with userform questions sara[_2_] Excel Programming 3 April 2nd 04 12:25 PM


All times are GMT +1. The time now is 01:02 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"