ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Transfer data from one worksheet to another (https://www.excelbanter.com/excel-programming/358043-transfer-data-one-worksheet-another.html)

CheriT63

Transfer data from one worksheet to another
 
At work we have spreadsheets that we call scorecards. They contain our reps
statistics on a monthly basis for various objectives they are expected to
meet. Some of the cells are protected and won't let us even select the
locked cells.

We are on our fourth template for the year and expect to get one or two more
before the scorecard is considered complete.

What I am wanting to do is create a macro that will allow me to transfer the
data from a previous version of the same scorecard to our newest one. All
the cells that are accessible in the new one are the same as in the old one.
I merely want to create a macro that will copy the data from the one sheet to
the other without doing it manually.

I can even provide the worksheets if necessary. Help!

Thanks,
Cheri

Tom Ogilvy

Transfer data from one worksheet to another
 
Sub ABC()
Dim v as Variant, v1 as Variant, i as Long
Dim sh as Worksheet, sh1 as Worksheet
Set sh = Workbooks("NewBook.xls").Worksheets(1)
Set sh1 = Workbooks("OldBook.xls").Worksheets(3)
' New form locations
v = Array("A1","B9","C10","A6")
' Corresponding old form Locations
v1 = Array("A1","B2","F11","A3")

for i = lbound(v) to ubound(v)
sh.Cells(v(i)).Value = sh1.Cells(v1(i)).Value
Next i
End sub

define the arrays to do the mapping between forms.

--
Regards,
Tom Ogilvy


"CheriT63" wrote in message
...
At work we have spreadsheets that we call scorecards. They contain our

reps
statistics on a monthly basis for various objectives they are expected to
meet. Some of the cells are protected and won't let us even select the
locked cells.

We are on our fourth template for the year and expect to get one or two

more
before the scorecard is considered complete.

What I am wanting to do is create a macro that will allow me to transfer

the
data from a previous version of the same scorecard to our newest one. All
the cells that are accessible in the new one are the same as in the old

one.
I merely want to create a macro that will copy the data from the one sheet

to
the other without doing it manually.

I can even provide the worksheets if necessary. Help!

Thanks,
Cheri





All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com