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
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
There's no need to select anything

Code:
Worksheets("Data2").Range("A3:BN3").Copy
 

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
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.
 

Alteran

Board Regular
Joined
Nov 25, 2009
Messages
117
Doh! yeah that worked Thanks VoG... its just to early in the morning for me I guess!
 

Watch MrExcel Video

Forum statistics

Threads
1,108,969
Messages
5,525,958
Members
409,673
Latest member
Riseee

This Week's Hot Topics

Top