ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User selecting range from userform via dropdown menue (https://www.excelbanter.com/excel-programming/303755-user-selecting-range-userform-via-dropdown-menue.html)

mslabbe

User selecting range from userform via dropdown menue
 
Hi All!

I've searched for this for a while, and have had no luck! Also, I will doe the best to
explain exactly what I'm trying to do...but it might be tough...here goes!

I'm using VB within Excel. From a userform, I'd like to use a drop down menue (which I
already know how to do). The list would be of ranges (already set-up via insert-name-
define). So, when the user selects the item, they would have selected a range in the
background. Then, I'd like to copy the now selected range and paste it to a new area.

This would be repeated everytime the user starts over, however, the ranges will be different
depending on which range the user selects.

Is it too confusing or impossible? I have tried recording a macro and using the
"application.goto" option, however, all that it does is a specific range name and I could
not have the user select it...

Thanks in advance
Matt

Tom Ogilvy

User selecting range from userform via dropdown menue
 
Private Sub Combobox1_Click()
Dim rng as Range
On error resume Next
set rng = Range(combobox1.Value)
On error goto 0
if not rng is nothing then
rng.copy Destination:=Range("AA1")
end if
End sub

--
Regards,
Tom Ogilvy

"mslabbe" wrote in message
...
Hi All!

I've searched for this for a while, and have had no luck! Also, I will

doe the best to
explain exactly what I'm trying to do...but it might be tough...here goes!

I'm using VB within Excel. From a userform, I'd like to use a drop down

menue (which I
already know how to do). The list would be of ranges (already set-up via

insert-name-
define). So, when the user selects the item, they would have selected a

range in the
background. Then, I'd like to copy the now selected range and paste it to

a new area.

This would be repeated everytime the user starts over, however, the ranges

will be different
depending on which range the user selects.

Is it too confusing or impossible? I have tried recording a macro and

using the
"application.goto" option, however, all that it does is a specific range

name and I could
not have the user select it...

Thanks in advance
Matt




Bob Phillips[_6_]

User selecting range from userform via dropdown menue
 
Matt,

Is it not just

With Activesheet
.Range(Me.Combobox1.Value).Copy Destination:=.Range("copyArea")
End With

from with the form

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mslabbe" wrote in message
...
Hi All!

I've searched for this for a while, and have had no luck! Also, I will

doe the best to
explain exactly what I'm trying to do...but it might be tough...here goes!

I'm using VB within Excel. From a userform, I'd like to use a drop down

menue (which I
already know how to do). The list would be of ranges (already set-up via

insert-name-
define). So, when the user selects the item, they would have selected a

range in the
background. Then, I'd like to copy the now selected range and paste it to

a new area.

This would be repeated everytime the user starts over, however, the ranges

will be different
depending on which range the user selects.

Is it too confusing or impossible? I have tried recording a macro and

using the
"application.goto" option, however, all that it does is a specific range

name and I could
not have the user select it...

Thanks in advance
Matt





All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com