Mefisto...diabeł czy anioł?
Jestem tu nowy, więc najpierw się przywitam
Mam makro ktore po wskazaniu folderu i wybraniu typu rozszezenia kopiuje aktywne zakładki jed± pod drug±. Oto te makro:
Global FileType As Variant
Global vrtUserSelection As Variant
Sub OpenFilesOneExcel()
Dim Folder As String
Dim Wb As Workbook
Dim EveryFile As String
Dim UserChoice As FileDialog
' Dim vrtUserSelection As Variant
Set UserChoice = Application.FileDialog(msoFileDialogFolderPicker)
With UserChoice
.AllowMultiSelect = False
' .Show done as below incase later development to allow user to select multiple paths
If .Show = -1 Then
For Each vrtUserSelection In .SelectedItems
Folder = vrtUserSelection
UserForm1.Show
'Continue:
' UserForm1.Hide
' "selected item's path: " & vrtUserSelection
Next
Else
MsgBox "Cancelled, please re-run macro!!"
End
End If
End With
Application.ScreenUpdating = False
' Folder = vrtUserSelection
teststring = Folder & "\*" & FileType
EveryFile = Dir(Folder & "\*" & FileType)
'Loop through all .xls files in folder path
Do While EveryFile <> ""
On Error GoTo Skip 'workbook with same name as thisworkbook cannot be opened
Set Wb = Workbooks.Open(Folder & "\" & EveryFile)
finaldestinationrow = ThisWorkbook.Worksheets("Sheet1").Range("A65536").End(xlUp).Row
FinalSourceRow = Range("A65536").End(xlUp).Row
Rows("1:" & FinalSourceRow).Copy Destination:=ThisWorkbook.Worksheets("Sheet1").Range("A" & finaldestinationrow + 1)
'______________
Wb.Close SaveChanges:=False
Skip:
EveryFile = Dir
Loop
End Sub
Sub FileTypeChooser()
If UserForm1.optcsv = True Then
FileType = ".csv"
ElseIf UserForm1.opttxt = True Then
FileType = ".txt"
ElseIf UserForm1.optxls = True Then
FileType = ".xls"
End If
UserForm1.Hide
End Sub
Jak zmienic te makro tak aby po wskazaniu folderu i wybraniu rozrzezenia pojawiało się cos na zasadzie folmularza, gdzie wybieralo by sie tylko niektore pliki i niektore zakładki z tych plików do skopiowania.
zanotowane.pl doc.pisz.pl pdf.pisz.pl katkaras.opx.pl
Mam makro ktore po wskazaniu folderu i wybraniu typu rozszezenia kopiuje aktywne zakładki jed± pod drug±. Oto te makro:
Global FileType As Variant
Global vrtUserSelection As Variant
Sub OpenFilesOneExcel()
Dim Folder As String
Dim Wb As Workbook
Dim EveryFile As String
Dim UserChoice As FileDialog
' Dim vrtUserSelection As Variant
Set UserChoice = Application.FileDialog(msoFileDialogFolderPicker)
With UserChoice
.AllowMultiSelect = False
' .Show done as below incase later development to allow user to select multiple paths
If .Show = -1 Then
For Each vrtUserSelection In .SelectedItems
Folder = vrtUserSelection
UserForm1.Show
'Continue:
' UserForm1.Hide
' "selected item's path: " & vrtUserSelection
Next
Else
MsgBox "Cancelled, please re-run macro!!"
End
End If
End With
Application.ScreenUpdating = False
' Folder = vrtUserSelection
teststring = Folder & "\*" & FileType
EveryFile = Dir(Folder & "\*" & FileType)
'Loop through all .xls files in folder path
Do While EveryFile <> ""
On Error GoTo Skip 'workbook with same name as thisworkbook cannot be opened
Set Wb = Workbooks.Open(Folder & "\" & EveryFile)
finaldestinationrow = ThisWorkbook.Worksheets("Sheet1").Range("A65536").End(xlUp).Row
FinalSourceRow = Range("A65536").End(xlUp).Row
Rows("1:" & FinalSourceRow).Copy Destination:=ThisWorkbook.Worksheets("Sheet1").Range("A" & finaldestinationrow + 1)
'______________
Wb.Close SaveChanges:=False
Skip:
EveryFile = Dir
Loop
End Sub
Sub FileTypeChooser()
If UserForm1.optcsv = True Then
FileType = ".csv"
ElseIf UserForm1.opttxt = True Then
FileType = ".txt"
ElseIf UserForm1.optxls = True Then
FileType = ".xls"
End If
UserForm1.Hide
End Sub
Jak zmienic te makro tak aby po wskazaniu folderu i wybraniu rozrzezenia pojawiało się cos na zasadzie folmularza, gdzie wybieralo by sie tylko niektore pliki i niektore zakładki z tych plików do skopiowania.