#1   Report Post  
Kevin Willhoit
 
Posts: n/a
Default Clearing List Boxes


I am working on a project in which one list box will populate the next
through vlookups. The only problem is that if you change one of the
boxes previous to another it does not clear them therefore they contain
false values. Any ideas on how to make the boxes clear when selecting
any of the previous boxes?


--
Kevin Willhoit
------------------------------------------------------------------------
Kevin Willhoit's Profile: http://www.excelforum.com/member.php...o&userid=24413
View this thread: http://www.excelforum.com/showthread...hreadid=380122

  #2   Report Post  
 
Posts: n/a
Default

Hi
I don't know! But I can suggest you take a look he
http://www.contextures.com/xlDataVal02.html
Sorry I can't be more help, but the above may point you in the right
direction. Sorry, too, if you've already tried Debra's site.

Cheers.
--
Andy.


"Kevin Willhoit"
<Kevin.Willhoit.1qs32c_1119024305.2233@excelforu m-nospam.com wrote in
message news:Kevin.Willhoit.1qs32c_1119024305.2233@excelfo rum-nospam.com...

I am working on a project in which one list box will populate the next
through vlookups. The only problem is that if you change one of the
boxes previous to another it does not clear them therefore they contain
false values. Any ideas on how to make the boxes clear when selecting
any of the previous boxes?


--
Kevin Willhoit
------------------------------------------------------------------------
Kevin Willhoit's Profile:
http://www.excelforum.com/member.php...o&userid=24413
View this thread: http://www.excelforum.com/showthread...hreadid=380122



  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I wasn't sure how you were using the listboxes and how you were using the
=vlookup()'s.

But I put 3 listboxes on a userform (listbox1, listbox2, and listbox3).

Listbox1 controls listbox2 which controls listbox3.

This is the code I had behind the userform:

Option Explicit
Dim blkProc As Boolean
Private Sub ListBox1_Change()
Dim iCtr As Long
Dim myChar As String
blkProc = True
Me.ListBox2.Clear
Me.ListBox3.Clear
blkProc = False
If Me.ListBox1.Value = "a1" Then
myChar = "x"
Else
myChar = "y"
End If
For iCtr = 1 To 10
Me.ListBox2.AddItem myChar & iCtr
Next iCtr
End Sub

Private Sub ListBox2_Change()
Dim iCtr As Long
Dim myChar As String

If blkProc = True Then Exit Sub

blkProc = True
Me.ListBox3.Clear
blkProc = False
If Me.ListBox2.Value = "x1" Then
myChar = "z"
Else
myChar = "w"
End If
For iCtr = 1 To 10
Me.ListBox3.AddItem myChar & iCtr
Next iCtr
End Sub

Private Sub ListBox3_Change()
If blkProc = True Then Exit Sub
MsgBox "hi"
End Sub

Private Sub UserForm_Initialize()
Dim iCtr As Long
For iCtr = 1 To 10
Me.ListBox1.AddItem "a" & iCtr
Next iCtr
End Sub

So if you go an change a previous listbox, then the "trailing" listboxes are
reset or reinitialized.

Maybe it'll help?

Kevin Willhoit wrote:

I am working on a project in which one list box will populate the next
through vlookups. The only problem is that if you change one of the
boxes previous to another it does not clear them therefore they contain
false values. Any ideas on how to make the boxes clear when selecting
any of the previous boxes?

--
Kevin Willhoit
------------------------------------------------------------------------
Kevin Willhoit's Profile: http://www.excelforum.com/member.php...o&userid=24413
View this thread: http://www.excelforum.com/showthread...hreadid=380122


--

Dave Peterson
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
Data Validation list boxes Watson Excel Discussion (Misc queries) 4 May 26th 05 05:12 PM
Clearing Check Boxes and Cells Mel Excel Discussion (Misc queries) 1 May 26th 05 05:13 AM
Clearing Check Boxes and Cells Mel Excel Discussion (Misc queries) 1 May 25th 05 09:00 PM
Clearing Check Boxes and Cells Mel Excel Worksheet Functions 0 May 25th 05 05:52 PM
Using symbols for drop down list boxes? Sumeet Benawra Excel Worksheet Functions 0 April 19th 05 11:41 AM


All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"