#1   Report Post  
Greg B
 
Posts: n/a
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  
Dave Peterson
 
Posts: n/a
Default

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 Discussion (Misc queries) 0 March 9th 05 12:46 AM
Listbox Question Greg B Excel Worksheet Functions 0 March 9th 05 12:46 AM
VBA Form Combo Box question. WTG Excel Discussion (Misc queries) 3 February 26th 05 04:28 PM
Question about combining data from multiple workbooks into one rep BookOpenandUpright Excel Discussion (Misc queries) 2 February 19th 05 12:37 PM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM


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