Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Selecting & copying a named range through a listbox

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Selecting & copying a named range through a listbox

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

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
Selecting more than 1 named range Diddy Excel Programming 2 February 17th 09 12:04 PM
Copying Named Ranges based on ListBox Results VBA_Newbie79 Excel Programming 1 June 29th 07 06:36 PM
Selecting a ListBox range JoeH[_2_] Excel Programming 4 September 7th 04 12:49 PM
Problem selecting a named range kkknie[_180_] Excel Programming 0 August 11th 04 08:30 PM
Selecting/Printing a Named Range via VBA Diane M Excel Programming 0 April 23rd 04 06:51 PM


All times are GMT +1. The time now is 11:22 AM.

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"