View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Dave Peterson[_5_] Dave Peterson[_5_] is offline
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