View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default One more question on ListBoxes (I hope)

So use AddPECNo to do it (or modify it to achieve whatever the new
requirement is). Or remember the results of the last time you used it.

--
Regards,
Tom Ogilvy

"asmenut" wrote in message
...
How? I thought that is what I did when I created the Sub AddPECNo.

"Tom Ogilvy" wrote:

when you are populating the box, why not check if the string is there at
that time.
--
Regards,
Tom Ogilvy

"asmenut" wrote in message
...
Thanks very much to Dave Peterson for his help with my "MultiSelect"

Listbox
problem.

I have one more delima that I need help with in regards to these

boxes.

Once I have populated the List_AddTo box, I need to search the box for

a
String (Rescinds PEC). If this string is in the list, then I need to

make
a
textbox visible for the user to add data to.

Any Ideas.

Private Sub CommandAdd_Click()
Dim i As Long

If List_AddFrom.ListIndex = -1 Then Exit Sub
If Not cbDuplicates Then
' See if item already exists
For i = 0 To Me.List_AddFrom.ListCount - 1
If List_AddFrom.Selected(i) = True Then
List_AddTo.AddItem List_AddFrom.List(i)
End If
Next i

For i = Me.List_AddFrom.ListCount - 1 To 0 Step -1
If Me.List_AddFrom.Selected(i) = True Then
Me.List_AddFrom.RemoveItem i
End If
Next i
End If
AddPECNo
End Sub


Private Sub CommandRemove_Click()
Dim i As Long

If List_AddFrom.ListIndex = -1 Then Exit Sub
If Not cbDuplicates Then
' See if item already exists
For i = 0 To Me.List_AddTo.ListCount - 1
If List_AddTo.Selected(i) = True Then
List_AddFrom.AddItem List_AddTo.List(i)
End If
Next i

For i = Me.List_AddTo.ListCount - 1 To 0 Step -1
If Me.List_AddTo.Selected(i) = True Then
Me.List_AddTo.RemoveItem i
End If
Next i
End If
End Sub

Private Sub AddPECNo()
Dim i As Long
If List_AddTo.ListIndex = -1 Then Exit Sub
For i = 0 To List_AddTo.ListCount - 1
If List_AddTo.List(i) = "Rescinds PEC" Then
LabelPEC.Visible = True
TextPEC.Visible = True
End If
Next i
End Sub