Macro-copy and paste a range

halfthumb

Board Regular
Joined
Oct 15, 2010
Messages
53
I have a problem that has me going around In circles.

I have a worksheet with four groups of ranges. The ranges are named
ONE,TWO,THREE and FOUR

What I want to do is, using an InputBox, is to select a range name,Then
when the range is selected-copy it to Cell H1.

Sub CopyRangetoH1()

Dim LIST As Range
Dim One As Range
Dim Two As Range
Dim Three As Range
Dim Four As Range

LIST = InputBox("Enter Number")
Select Case LIST
Case Is = One
ActiveCell = One
'Range("H1") = ActiveRange

Case Is = Two
ActiveCell = Two
'Range("H1") = ActiveRange

Case Is = Three
ActiveCell = Three
' Range("H1")= ActiveRange

Case Is = Four
ActiveCell = Four
' Range("H1")= ActiveRange
End Sub

Paul B
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
83,071
Office Version
  1. 365
Platform
  1. Windows
Hello Halfthumb
Give this a go
Code:
Sub CopyRangetoH1()

    Dim LIST As String

    LIST = InputBox("Enter Number")
    Range(LIST).Copy Range("H1")

End Sub
 
Upvote 0

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
83,071
Office Version
  1. 365
Platform
  1. Windows
Not a problem & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,190,872
Messages
5,983,330
Members
439,839
Latest member
iblackie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top