Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default One more question on ListBoxes (I hope)

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






  #2   Report Post  
Posted to microsoft.public.excel.programming
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









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
Templete question...I hope there is an answer Rookie000 Excel Worksheet Functions 3 January 15th 06 04:04 AM
VLOOKUP() Question... i hope Adam Kroger Excel Discussion (Misc queries) 2 November 29th 05 10:22 PM
fairly basic excel question (i hope) mibro Excel Programming 1 June 28th 04 01:04 AM
Beginner question (I hope) chadt74 Excel Programming 2 April 23rd 04 02:13 PM
Listboxes Lionel Fridjhon Excel Programming 0 April 5th 04 06:28 PM


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