Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT, ERASE, EDIT items in listbox

Besides the multiple access in excel(still havn't solve the problem..
), I got another question want to throw to this group.. :<

I got 2 button in a userform... 1 is Erase button, and 1 is Edi
button. Both of this 2 button will delete the row that I choose i
listbox, how am I going to program this 2 button? Below is the cod
that used to select item and display which item u choose... But I dunn
how to delete the row that I choose... The rowsource for the listbox i
"ListBox1.RowSource = "Sheet1!range" "



Private Sub EraseButton_Click()
Msg = ""
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then _
Msg = Msg & ListBox1.List(i) & vbCrLf
Next i
MsgBox "Are you sure u wana delete this Selected row: " & _ vbCrL
& Msg
...
...
End Sub

Please somebody can help me to program this?

And for the Edit button, I want to do such that when I select the ro
in listbox, and click on edit button, the data that stored in th
spreadsheet will appear in the textbox in the userform respectively...


Hope to hear from others.... as I already took so much time in doi
such a userform...My boss is unhappy with tat... :

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT, ERASE, EDIT items in listbox

really no one can help me on this?

:

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT, ERASE, EDIT items in listbox

Sorry.... But really nobody can solve my problem..

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT, ERASE, EDIT items in listbox

Perhaps anyone got any links that can sent to me for my reference..?

I'm desperately need it.... THanks..

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SELECT, ERASE, EDIT items in listbox

http://tinyurl.com/25nvq

--
Regards,
Tom Ogilvy


"unplugs " wrote in message
...
Perhaps anyone got any links that can sent to me for my reference..?

I'm desperately need it.... THanks...


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SELECT, ERASE, EDIT items in listbox

Thanks Tom! Anyway, I had work it out wif the solution u provide las
time..

Private Sub CommandButton1_Click()
'Delete Selection
Set rng = Range(ListBox1.RowSource)
idex = ListBox1.ListIndex
If idex = -1 Then Exit Sub
ListBox1.RowSource = ""
rng(idex + 1).EntireRow.Delete
Set rng1 = Worksheets("Sheet1").Range("A1").CurrentRegion
Set rng1 = rng1.Offset(1, 0).Resize(rng1.Rows.Count - 1)
ListBox1.RowSource = rng1.Address(external:=True)
End Sub

Your code works great... And it can delete my selected items i
listbox! Anyway, the problem is, after I delete the items in a row, al
of the range that I define had modified!

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),10)
change to the below:

=OFFSET(Sheet1!#REF!,0,0,COUNTA(Sheet1!$A:$A),10)

After that, my program gave me error message because of the range ha
been modified...! U got any idea of this? Or anyone got any idea abou
this

--
Message posted from http://www.ExcelForum.com

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
Select Multiple Items and return value for Dropdown or listbox kookie Excel Discussion (Misc queries) 4 January 19th 09 10:18 PM
Problem using INDEX to select items in listbox Shazbot Excel Discussion (Misc queries) 3 April 28th 06 09:06 AM
Adding Items to a ListBox-Unique Items Only jpendegraft[_14_] Excel Programming 2 May 2nd 04 02:27 AM
Items in a Listbox Todd Huttenstine Excel Programming 1 April 26th 04 03:36 PM
Listbox--moving items up or down libby Excel Programming 0 November 7th 03 06:53 PM


All times are GMT +1. The time now is 12:15 AM.

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"