Hi i`m using the following macro to import data from one sheet to another :
Sub Data_transfer()
'
' Data_transfer Macro
'
'
Dim fd As FileDialog
Dim vrtSelectedItem As Variant
Dim sBestandsnaam As String
Dim sBronbestand As String
sBronbestand = ActiveWorkbook.Name
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Use a With...End With block to reference the FileDialog object.
With fd
If .Show = -1 Then
'Step through each string in the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems
sBestandsnaam = vrtSelectedItem
Next vrtSelectedItem
'The user pressed Cancel.
Else
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
'Open gekozen bestand.
Workbooks.Open Filename:=sBestandsnaam
'Selecteer lotnummer.
Sheets("Blad1").Range("B2").Copy
'Plak de gegevens.
Workbooks(sBronbestand).Sheets("Basisgegevens").Range("B7").PasteSpecial Paste:=xlPasteValues
'Selecteer klantcode.
Sheets("Blad1").Range("A9:A40").Copy
'Plak de gegevens.
Workbooks(sBronbestand).Sheets("Basisgegevens").Range("B15:B46").PasteSpecial Paste:=xlPasteAll
'Selecteer activiteit.
Sheets("Blad1").Range("B9:B40").Copy
'Plak de gegevens.
Workbooks(sBronbestand).Sheets("Basisgegevens").Range("D15:D46").PasteSpecial Paste:=xlPasteAll
'Selecteer calibratie datum.
Sheets("Blad1").Range("N9:N40").Copy
'Plak de gegevens.
Workbooks(sBronbestand).Sheets("Basisgegevens").Range("E15:E46").PasteSpecial Paste:=xlPasteValues
'Zet de copy mode uit.
Application.CutCopyMode = False
'Sluit geselecteerd bestand.
Workbooks(Right(sBestandsnaam, Len(sBestandsnaam) - InStrRev(sBestandsnaam, "\"))).Close SaveChanges:=False
'Opruimen dialoog object
Set fd = Nothing
End Sub
however this always opens library\documents so then i have to browse towards my folder where the input files are located. Is there a way to let this macro always open with for example C:/Program Files ?
Bookmarks