ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy values between files. (https://www.excelbanter.com/excel-programming/293350-copy-values-between-files.html)

Ron[_20_]

Copy values between files.
 
Hello
I hope I can explain my problem well enough to be understood.
I have two files one is a summary file the other is the rate file.
would like to copy values from the rate file to the summary file. Ther
are four sets of values in a group and 19 groups. The correspondin
values in each group are in the same columns and are the same number o
rows from the previous group proceeding down the spreadsheet. Eac
value in the rate file needs to be copied to a specific cell in th
summary file.
I am attempting to loop though each set of values within a group (inne
loop) then loop though each group (outer loop) and copy the values t
the summary file.
Below is my code thus far. Currently I only coded copying one set o
values in each group. If necessary I can send the files if it i
possible to attach them to a message.
Thanks.
Ron


Sub CopyToSum ()

Dim rRCount As Integer
Dim cRCount As Integer
Dim rSCount As Integer
Dim cSCount As Integer

rRCount = 15
cRCount = 5
rSCount = 7
cSCount = 4

For X = 1 To 19

For Y = 1 To 4

Windows("off site base rate4.xls").Activate
Cells(rRCount, cRCount).Select
Selection.Copy
Windows("off site base sum4.xls").Activate
Cells(rSCount, cSCount).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

rRCount = rRCount + 0
cRCount = cRCount + 2
rSCount = rSCount + 1
cSCount = cSCount + 0

Next Y

rRCount = rRCount + 48
cRCount = cRCount + 0
rSCount = rSCount + 4
cSCount = cSCount + 0

Next X

End Su

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:30 PM.

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