Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default How to delete item from listbox?

On Monday, October 22, 2012 9:39:00 AM UTC-4, questionguy wrote:
Thanks for your reply. I inserted your code, everything seemed to work

except it actually didn't delete anything. Was I doing something wrong?





----------------------

Hi

Try this:

Private Sub cmddelete_Click()

Dim msgResponse As String, c As Range

Application.ScreenUpdating = False

msgResponse = MsgBox("This will delete the selected record.

Continue?", _

vbCritical + vbYesNo, "Delete Entry")

Select Case msgResponse

Case vbYes

Set c = ActiveCell

c.Delete

Case vbNo

Exit Sub

End Select

Application.ScreenUpdating = True

End Sub





+-------------------------------------------------------------------+

+-------------------------------------------------------------------+







--

questionguy


Hi
No You didn't do anything wrong, I did.I didn't try it on your WS
Try this one.
Private Sub cmddelete_Click()
Dim msgResponse As String, c As Variant
Application.ScreenUpdating = False

msgResponse = MsgBox("This will delete the selected record. Continue?", _
vbCritical + vbYesNo, "Delete Entry")

Select Case msgResponse
Case vbYes
c = listaccount.Value
On Error Resume Next
Columns("B:E").Find(What:=c, _
LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
Set c = ActiveCell
If ActiveCell = Range("Purchaser_Info") Then
c.Resize(1, 2).Clear
Else
c.Clear
End If
Case vbNo
Exit Sub
End Select
Application.ScreenUpdating = True

End Sub
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
Delete selected Item from listbox Office_Novice Excel Programming 2 May 1st 08 03:12 PM
move item from one listbox to another listbox steve Excel Programming 6 March 6th 08 05:02 PM
Remove Item from Listbox by Item Name Randy[_2_] Excel Programming 3 September 19th 07 02:36 PM
Double click item in Listbox to select item and close Listbox GusEvans Excel Programming 3 July 19th 07 12:36 PM
listbox add item Baha Excel Programming 0 December 8th 06 02:37 AM


All times are GMT +1. The time now is 05:41 PM.

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"