PDA

View Full Version : Solved: What's wrong???



MPDK166
03-25-2011, 01:17 AM
Can somebody tell me what is wrong with this code??? BTW this is a part of my code

Dim cRow As Range
For Each cRow In Range("A1:A5")
Address = Range("cRow").Address
Worksheets("Blad2").Range("cRow").Offset(0, 1) = GetData(FilePath, FileName, SheetName, Address)
Next cRow

mancubus
03-25-2011, 01:49 AM
hi.
try:


myAddress = cRow.Address

MPDK166
03-25-2011, 02:10 AM
Unfortunately I doesn't work...

Here is another part of my code!



Private Function GetData(path, file, sheet, Address)
Dim Data$
Data = "'" & path & "[" & file & "]" & sheet & "'!" & Range(Address).Range("A1").Address(, , xlR1C1)
GetData = ExecuteExcel4Macro(Data)
End Function


Any other solutions???

MPDK166
03-25-2011, 03:20 AM
I solved it....

mancubus
03-25-2011, 03:24 AM
since it is a variable for range object, remove all "Range"s and quotes before and after cRow in the code.

Aussiebear
03-25-2011, 03:50 AM
I solved it....

Good then you won't mind putting the solution up for all to see then