list box question

C

Chris Salcedo

I now have a populated list box on my form. I now need to take each
value (its the name of a named range) and copy that range to another
sheet...


How do I create the loop ??????

On Error Resume Next
Sheets(Me.DestTextBox.Text).Delete

Sheets.Add
ActiveSheet.Name = Me.DestTextBox.Text 'my sheet

The "somehow read the RightListBox starting with the first entry"
Loop

Set lastcell = Cells.SpecialCells(xlLastCell)' find the last
mrows = lastcell.Row ' used row

Set rng = the first item in the list

rng.Copy Destination:=Worksheets(Me.DestTextBox.Text).Range("A" &
(mrows + 1))

Next entry

Any ideas ??????

Thanks

Chris
 
H

Harald Staff

Hi

Using an ActiveX listbox:

Sub test()
Dim L As Long
Dim S As String
For L = 0 To Me.ListBox1.ListCount - 1
S = Me.ListBox1.List(L)
MsgBox S
Next
End Sub

HTH. Best wishes Harald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top