Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Create ListBox (?) same as Find all Result List Soniya Excel Programming 1 October 2nd 03 01:22 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


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