ParaSitius
New Member
- Joined
- Nov 11, 2013
- Messages
- 11
Hi all,
I'm looking for help in changing the following code as it is currently set to copy from a specific cell, the problem I have is that I have no guarantee that the data will stay in those same cells. The one constant is that the figures will always be at the bottom of the column even if rows are added or removed above them.
The totals in the Data File range from D400 to D405 but I only require 4 of the 6 figures for the report, I will also add that the the way the data file is formatted, the data starts from Cell D10 and there are some cells containing no data in the column.
I've tried searching the internet but all the coding that I've found keep throwing back errors of one kind or another.
Thanks in advance.</location></location>
I'm looking for help in changing the following code as it is currently set to copy from a specific cell, the problem I have is that I have no guarantee that the data will stay in those same cells. The one constant is that the figures will always be at the bottom of the column even if rows are added or removed above them.
Code:
Sub Code()
Dim x As Workbook
Dim y As Workbook
'## Open Data File (x) and Final Report (y) workbooks first:
Set y = Workbooks.Open("file location<location of="" final="" report="">")
Set x = Workbooks.Open("file location<location of="" data="" file="">")
'Now, transfer values from x to y:
y.Sheets("Cover Summary").Range("C8").Value = x.Sheets("Worksheet").Range("D400")
y.Sheets("Cover Summary").Range("D8").Value = x.Sheets("Worksheet").Range("D401")
y.Sheets("Cover Summary").Range("F8").Value = x.Sheets("Worksheet").Range("D403")
y.Sheets("Cover Summary").Range("H8").Value = x.Sheets("Worksheet").Range("D404")
The totals in the Data File range from D400 to D405 but I only require 4 of the 6 figures for the report, I will also add that the the way the data file is formatted, the data starts from Cell D10 and there are some cells containing no data in the column.
I've tried searching the internet but all the coding that I've found keep throwing back errors of one kind or another.
Thanks in advance.</location></location>