Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Deleting Whole Rows From ListBox2

Hello:

I have a UserForm that has a listbox in it that I use to verify
an entry has been made. I wrote a Sub to add a record to
the range that populates the ListBox, sorts it, and refreshes
it. The range name is "DBList." and it is stored on a sheet
name Sheet6!DBList.

The listbox is a multiple select type. I am having a bit of trouble
removing the selected items from the listbox, which would
entail the complete removal of that line within Sheet6!DBList
range.

Any assistance would be appreciated. Thanks -Randy-

..



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting Whole Rows From ListBox2

Private Sub CommandButton1_Click()
Dim rng As Range
Dim i As Long
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
If rng Is Nothing Then
Set rng = Range("DBLIST").Cells(i + 1, 1)
Else
Set rng = Union(rng, Range("DBLIST").Cells(i + 1, 1))
End If
ListBox1.Selected(i) = False
End If
Next
If Not rng Is Nothing Then
ListBox1.RowSource = ""
rng.EntireRow.Delete Shift:=xlShiftUp
ListBox1.RowSource = "DBLIST"
End Sub


--
Regards,
Tom Ogilvy



Randal W. Hozeski wrote in message
news:9HqCb.97823$_M.512375@attbi_s54...
Hello:

I have a UserForm that has a listbox in it that I use to verify
an entry has been made. I wrote a Sub to add a record to
the range that populates the ListBox, sorts it, and refreshes
it. The range name is "DBList." and it is stored on a sheet
name Sheet6!DBList.

The listbox is a multiple select type. I am having a bit of trouble
removing the selected items from the listbox, which would
entail the complete removal of that line within Sheet6!DBList
range.

Any assistance would be appreciated. Thanks -Randy-

.





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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM


All times are GMT +1. The time now is 10:21 PM.

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"