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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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
Not a problem & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,122
Members
451,399
Latest member
alchavar

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
Back
Top