LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default UserForm Listbox Selected Item Manipulation

I have a userform with a MultiSelect listbox. How do I write a code to use
the item(s) selected by clicking a CommandButton on the same userform?

What I am trying to make happen is for the selcted items replace the entry
in the D column of the origin WS("Complete Listing") with the name of the WS
from which the UserFrom is activated. Then it would copy the rows A-F and
paste them in the WS it was activated from starting in row 9.

Here is what the code looks like now.

Private Sub UserForm_Initialize()
' Identifying elements
Dim ListBoxRange As Range
Dim LastRow As Long
' Identifying which sheet to pull info from
With Worksheets("Complete Listing")
'Telling it to count to the last used cell in column "F"
LastRow = .Cells(.Rows.Count, "F").End(xlUp).Row
'Telling it to set the range from A4 to F(LastRow)
Set ListBoxRange = .Range("A4:F" & LastRow)
End With

'Operations on the item checkout listbox
With Me.ListBox1
'Clearing data from the list
.Clear
'counting the number of columns
.ColumnCount = ListBoxRange.Columns.Count
'telling it to use the range set above for the listbox
.List = ListBoxRange.Value
End With
End Sub


 
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
Selected listbox item [email protected] Excel Programming 2 May 25th 09 12:15 PM
Selected ListBox item to TextBox Honnore Excel Programming 6 April 27th 09 06:57 AM
Worksheet Listbox selected item? Webtechie Excel Programming 3 August 14th 08 08:27 PM
Delete selected Item from listbox Office_Novice Excel Programming 2 May 1st 08 03:12 PM
How to get the index in VBA of the selected item in a ListBox Stefan Mueller[_2_] Excel Programming 4 July 16th 07 07:19 PM


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