Consulting

Results 1 to 1 of 1

Thread: Sleeper: Importing multiple files to excel

  1. #1

    Sleeper: Importing multiple files to excel

    Hi!
    I'm complete beginner in VBA, but i see it can be used in excel.
    I would like to import all files from folder, place each file in different working sheet and change sheet name according to file name.
    I found code like that, but it doesn't work.

    Sub LoopAllFilesInAFolder()
    'Loop through all files in a folder
    Dim fileName As Variant
    fileName = Dir("C:\Users\Kasutaja\Dropbox\MJ")
    While fileName <> ""
    'Insert the actions to be performed on each file
        'This example will print the file name to the immediate window
        Debug.Print fileName
        Windows(fileName).Activate
        'Set the fileName to the next file
        fileName = Dir
    Wend
    End Sub
    How should i change it?
    Thanks!
    Attached Images Attached Images

Tags for this Thread

Posting Permissions

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