Copy/Paste Excel Named Ranges on inactive sheet

As part of a larger macro (already working), I would like to copy the data from the Start range on Sheet2 to the Finish range on the same sheet.  The ranges are the same size and are on an inactive sheet.  The code I have gives me Run-time error '1004': Method 'Range' of object '_Worksheet' failed.  I am including the pertinent code.  I am sure I am missing something stupid.  Any help is greatly appreciated.

Dim sourceSht As Worksheet, outputSht As Worksheet
Dim sourceRange As Range
Dim start As Range
Dim finish As Range

'Set the active sheet to the current sheet
Set sourceSht = ActiveSheet

'Set the output to Sheet2
Set outputSht = ActiveWorkbook.Sheets("Sheet2")

'Set the start variable to the Start range on Sheet 2
Set start = outputSht.Range("Start")

'Set the finish variable to the Finish range on Sheet 2
Set finish = outputSht.Range("Finish")

'Turn off screen updating
Application.ScreenUpdating = False

'Copy the cells from the Sheet2 Start range and copy them to the Sheet 2 Finish range
start.Copy (finish)

Open in new window

M_PattonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try (line 13 sourceSht instead of outputSht)

Dim sourceSht As Worksheet, outputSht As Worksheet
Dim sourceRange As Range
Dim start As Range
Dim finish As Range

'Set the active sheet to the current sheet
Set sourceSht = ActiveSheet

'Set the output to Sheet2
Set outputSht = ActiveWorkbook.Sheets("Sheet2")

'Set the start variable to the Start range on Sheet 2
Set start = sourceSht.Range("Start")

'Set the finish variable to the Finish range on Sheet 2
Set finish = outputSht.Range("Finish")

'Turn off screen updating
Application.ScreenUpdating = False

'Copy the cells from the Sheet2 Start range and copy them to the Sheet 2 Finish range
start.Copy finish

End Sub

Open in new window

regards
0
M_PattonAuthor Commented:
Same error (plus that is not where the data is).
0
ProfessorJimJamCommented:
can you try this

Dim sourceSht As Worksheet, outputSht As Worksheet
Dim sourceRange As Range
Dim start As Range
Dim finish As Range

'Set the active sheet to the current sheet
Set sourceSht = ActiveSheet

'Set the output to Sheet2
Set outputSht = ThisWorkbook.Worksheets("Sheet2")

'Set the start variable to the Start range on Sheet 2
Set start = outputSht.Range("Start")

'Set the finish variable to the Finish range on Sheet 2
Set finish = outputSht.Range("Finish")

'Turn off screen updating
Application.ScreenUpdating = False

'Copy the cells from the Sheet2 Start range and copy them to the Sheet 2 Finish range
start.Copy finish

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

M_PattonAuthor Commented:
Same error.

BTW: Debugger indicated issue is in line 10.
0
ProfessorJimJamCommented:
please see the attached file.

i have put the macro in the workbook. i have the two named ranges start and finish

and when u run the macro, it will copy the start range and will paste it in finish range.

no error is there.

please let me know if you get any error in this workbook.
Book1.xlsm
0
M_PattonAuthor Commented:
PJJ--

Thank you for the workbook; it brought to my attention that my named ranges had not been saved.  Once that happened, your previous code worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.