VBA code to copy specific range

Alteran

Board Regular
Joined
Nov 25, 2009
Messages
117
I am trying to get VBA to allow me to select a specific range of cells to copy, however it keeps giving me an error when I do the range select, I have tried this two different ways and still get the same issue can anyone help me out with this?

#1:
Code:
        'Select the data wanted
        Sheets("Combined Data").Select
        Range("A3:BN3").Select
            'Copies the Data
            Selection.Copy
                'Back to original Sheet
                Sheets("Administration").Select

#2
Code:
        'Select the data wanted
        Worksheets("Data2").Range("A3:BN3").Select
            'Copies the Data
            Selection.Copy
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
There's no need to select anything

Code:
Worksheets("Data2").Range("A3:BN3").Copy
 
Upvote 0
There's no need to select the data first

Code:
Worksheets("Data2").Range("A3:BN3").Copy
Which might be the answer if Data2 isn't the currently active sheet.
 
Upvote 0
Doh! yeah that worked Thanks VoG... its just to early in the morning for me I guess!
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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