Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default Listbox Question

I have userform4 where I have put a command button and listbox on it, this
is connected to a sheet called Hidden.

I want to allow the user to select the text in the userbox and click on the
command button to delete that certain entry on the worksheet.

Is this possible, How to I acheive this to happen.

Thanks in advance

Greg


  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,758
Default Listbox Question

This worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()
If Me.ListBox1.ListIndex -1 Then
With Worksheets("Hidden")
.Rows(Me.ListBox1.ListIndex + 1).Delete
Call UserForm_Initialize
End With
End If
End Sub
Private Sub UserForm_Initialize()
Dim myArray As Variant

With Worksheets("Hidden")
myArray = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)).Value
If IsArray(myArray) Then
'ok
Else
myArray = Array(myArray)
End If
End With
Me.ListBox1.List = myArray
End Sub

My list was in A1:Axx on a worksheet called Hidden.

Greg B wrote:

I have userform4 where I have put a command button and listbox on it, this
is connected to a sheet called Hidden.

I want to allow the user to select the text in the userbox and click on the
command button to delete that certain entry on the worksheet.

Is this possible, How to I acheive this to happen.

Thanks in advance

Greg


--

Dave Peterson
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 Question Greg B Excel Worksheet Functions 0 March 9th 05 12:46 AM
listbox question GMet Excel Programming 1 September 27th 04 07:59 PM
ListBox Question Tom Ogilvy Excel Programming 1 August 24th 04 05:43 PM
ListBox Question Randal W. Hozeski Excel Programming 7 December 20th 03 09:59 PM
Listbox question Stuart[_5_] Excel Programming 1 August 21st 03 07:16 PM


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