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- .. |
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/ |
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! |
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! |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com