Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox Result
I have a single select ListBox1 that contains unique
items from a list called "Data". I want to do subs with the returned value of the Listbox. 1. Take selected item and delete all records (lines) with that unique item. If that is the last item in "Data" an error handler to still maintain the name and ListBox. 2. Take selected item and then AutoFilter by it. ending it by selecting the items filtered by excluding headers. 3. Copy and paste that value in a cell on a different page. -Randy- .. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox Result
Hi Randy,
You can know the selected value with this code. Code: -------------------- ListBox1.list(ListBox1.listindex) -------------------- If MultiSelect has been used, need to loop like this. Code: -------------------- For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) Then MsgBox "Item " & i + 1 & " has been Selected" End If Next -------------------- Regarding to how to copy Autofiltered(excluding headers) range would be as follows. Code: -------------------- With Sheets(1).AutoFilter.Range .Resize(.Rows.Count - 1).Offset(1).Copy Sheets(2).Cells(1, 1) End With -------------------- --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox Result
I think my AutoFilter question was misunderstood.
It is to AutoFilter whatever is selected from a single select ListBox (the result) not copy it. -Randy- *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox Result
With Worksheets("Sheet1")
.Activate .Range("A1"). _ currentRegion.AutoFilter Field:=4, _ Criteria1:=Userform1.Listbox1.Value With.autofilter.Range .offset(1,0).Resize(.Rows.count-1). _ specialcells(xlVisible).Select End With End With -- Regards, Tom Ogilvy Randal W. Hozeski wrote in message ... I think my AutoFilter question was misunderstood. It is to AutoFilter whatever is selected from a single select ListBox (the result) not copy it. -Randy- *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Create ListBox (?) same as Find all Result List | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |