Hello all
for a long time i tried to figure out how to make the right vba code for my problem. Found some examples already but can't succeed to adjust them properly. I lack the knowledge sadly. Maby someone can help me a bit further.
In short: i have about 2000 files made in excel. They are all the same. Now i need to copy name of file in A2, from sheet "Algemeen" D3 in B2, D6 in B3. If there is no data in them i need a warning like *empty , (but thats not stricktly necessary, I also need more data from othersheets but i hope i can figure out that myself later). I found an example code from rondebruin. It works when using his examplefile but when putting into another folder i get a error. Next is how can i "range" the cells; maby i understand "ranging" wrong? SourceRng:="D3,D6", doesnt work. If this code is not suitable can someone send me a link where i can find a better one?
many thanks already.
greetings PeterDV
--------------
Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long
myCountOfFiles = Get_File_Names( _
MyPath:="H:\My documents\_doc_bureaublad\Peter\macro maken cellen", _
Subfolders:=False, _
ExtStr:="*.xls", _
myReturnedFiles:=myFiles)
If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If
Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="Algemeen", _
SourceShIndex:=1, _
SourceRng:="D3", _
StartCell:="", _
myReturnedFiles:=myFiles
End Sub
Bookmarks