Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

copying data from current workbook to another different ranges

excel 2003
need a vba sub
to be placed behind a command button


2 workbooks
1.  workingcopy.xls
1st workbook can be placed and used from anywhere
sheet name =  sheet1


2.
C:\PROGRAM FILES\DATA1\FINAL.XLS
always in this location
sheet name =  sheet1

Column Headers in BOTH worksheets
A1:AU1

The data will always start on row2 in  workingcopy.xls

THE amount of rows will always vary...

copying data from  workingcopy.xls  to final.xls




Thanks
fordraiders





ASKER CERTIFIED SOLUTION
Avatar of Jignesh Thar
Jignesh Thar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Replace path "D:\Documents and Settings\jignesh.thar\My Documents\FINAL.xls" with C:\PROGRAM FILES\DATA1\FINAL.XLS
Avatar of TinTombStone
TinTombStone

Assuming that the headers in both Working and Final are the same

Run this from workingcopy.xls

Sub CopyToFinal()

Dim rng As Range

    Set rng = Range("'[C:\PROGRAM FILES\DATA1\FINAL.XLS]Sheet1'!A1")

    Range("A1").CurrentRegion.Copy rng

End Sub
Sorry, scrub the above.  I'm just not thinking straight, jigneshthar has it right
Avatar of Fordraiders

ASKER

Thanks