Consulting

Results 1 to 6 of 6

Thread: Solved: What's wrong???

  1. #1
    VBAX Regular
    Joined
    Mar 2011
    Posts
    52
    Location

    Solved: What's wrong???

    Can somebody tell me what is wrong with this code??? BTW this is a part of my code

    [VBA]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[/VBA]

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    hi.
    try:

    [VBA]
    myAddress = cRow.Address

    [/VBA]
    Last edited by mancubus; 03-25-2011 at 02:02 AM.
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    VBAX Regular
    Joined
    Mar 2011
    Posts
    52
    Location
    Unfortunately I doesn't work...

    Here is another part of my code!



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

    Any other solutions???
    Last edited by MPDK166; 03-25-2011 at 03:10 AM.

  4. #4
    VBAX Regular
    Joined
    Mar 2011
    Posts
    52
    Location
    I solved it....

  5. #5
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    since it is a variable for range object, remove all "Range"s and quotes before and after cRow in the code.
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Quote Originally Posted by MPDK166
    I solved it....
    Good then you won't mind putting the solution up for all to see then
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •