Dibbley247
01-26-2013, 08:15 AM
I have currently running a code which will open workbooks and paste into one sheet.
I have however come up with a problem which I can't quite code right!
I want to open up a file which is a known name, then a sheet which I know PART of the name PLUS what ever is in A1, and I know the Range.
So the Sheet im taking from is called: 3 Days 25.1.13 so I know the start of this sheet is called 3 Days, but the DATE will be in Cell A1
so effectively I want Sheets ("3 days & A1 value")
Here is the code which i'm trying to change:
Sub Staff()
Sheets("3 days week 1").Range("H5") = GetData("\\calfp03\Lynher (file://\\calfp03\Lynher) Bakery\3 days\", "staffing trial.xls", Sheets("Summary") & Range("A1").Value, "H5")
End Sub
Private Function GetData(Path, File, Sheet, Address)
Dim Data$
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & Range(Address).Range("A1").Address(, , x1R1C1)
GetData = ExecuteExcel4Macro(Data)
End Function
What am i doing wrong?
I have however come up with a problem which I can't quite code right!
I want to open up a file which is a known name, then a sheet which I know PART of the name PLUS what ever is in A1, and I know the Range.
So the Sheet im taking from is called: 3 Days 25.1.13 so I know the start of this sheet is called 3 Days, but the DATE will be in Cell A1
so effectively I want Sheets ("3 days & A1 value")
Here is the code which i'm trying to change:
Sub Staff()
Sheets("3 days week 1").Range("H5") = GetData("\\calfp03\Lynher (file://\\calfp03\Lynher) Bakery\3 days\", "staffing trial.xls", Sheets("Summary") & Range("A1").Value, "H5")
End Sub
Private Function GetData(Path, File, Sheet, Address)
Dim Data$
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & Range(Address).Range("A1").Address(, , x1R1C1)
GetData = ExecuteExcel4Macro(Data)
End Function
What am i doing wrong?