KlausW
Active Member
- Joined
- Sep 9, 2020
- Messages
- 378
- Office Version
- 2016
- Platform
- Windows
I use this code to import sheets with, it runs optimally, but I wish I could open a dialog box and select the folder where I want to import the sheets from.
Any help will be much appreciated.
Many Thanks
Klaus W
Any help will be much appreciated.
Many Thanks
Klaus W
VBA Code:
Sub Rektangelafrundedehjørner1_Klik() (It is a button)
Dim ws As Worksheet
Dim Wbk As Workbook
Dim Pth As String, Fname As String
Pth = Range("o1").Value
Fname = Dir(Pth & "*.xlsm")
Do While Fname <> ""
Set Wbk = Workbooks.Open(Pth & Fname)
For Each ws In Wbk.Worksheets
If Not ShtExists(ws.Name, ThisWorkbook) Then
ws.Copy , ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
End If
Next ws
Wbk.Close False
Fname = Dir
Loop
End Sub