From: Luc on 12 Jan 2010 07:07 When i click on a button i want a listbox to pop up. In this listbox there has to appear a list with named ranges. The named range which is selected in this listbox has to be copied Can somenone give me some code for this. That's it ! Thanxxx, Luc
From: Ryan H on 12 Jan 2010 15:26 Since your post is kinda vague I will have to ask some questions and makes some assumptions. 1.) Are you wanting to select multiple ranges to be copied from a listbox or select a single range to be copied from a combobox? 2.) Where do you want the range copied to? Another worksheet, workbook, somewhere else within the sheet? 3.) Are you wanting to copy values only or all formats? This can get you started. Start a userform and put a combobox and command button in it. Then put this code in the userform module. When you call the userform the combobox will be filled with all the names in your workbook. Select the name you want to copy then click the command button. Once you click the command button it will copy that range to Sheet2 starting in A1. Hope this helps! If so, let me know, click "YES" below. Option Explicit Private Sub UserForm_Initialize() Dim n As Name ' add range names to combobox With Me.ComboBox1 For Each n In Names .AddItem n.Name Next n End With End Sub Private Sub CommandButton1_Click() ' copy selected named range to sheet2 starting at A1 Range(Me.ComboBox1.Text).Copy Sheets("Sheet2").Range("A1") End Sub -- Cheers, Ryan "Luc" wrote: > When i click on a button i want a listbox to pop up. > In this listbox there has to appear a list with named ranges. > The named range which is selected in this listbox has to be copied > > Can somenone give me some code for this. > > That's it ! > > Thanxxx, > > Luc
|
Pages: 1 Prev: Calculating cells on workbook_open failing without message Next: Morefunc dying |