KlausW
Active Member
- Joined
- Sep 9, 2020
- Messages
- 453
- Office Version
- 2016
- Platform
- Windows
Hi
I have a challenge with this VBA code.
I would like to be able to change the name of the sheets I would like to import.
I can get it to run if I change the line
With ActiveWorkbook.Sheets.Nanme = Range("C1").Value
To
With ActiveWorkbook.Sheets("IBM")
The name of the sheet I would like to be imported is in C1
Any help will be appreciated
Best Regards
Klaus W
I have a challenge with this VBA code.
I would like to be able to change the name of the sheets I would like to import.
I can get it to run if I change the line
With ActiveWorkbook.Sheets.Nanme = Range("C1").Value
To
With ActiveWorkbook.Sheets("IBM")
The name of the sheet I would like to be imported is in C1
Any help will be appreciated
Best Regards
Klaus W
VBA Code:
Sub Rektangelafrundedehjørner1_Klik()
Dim Path As String
Dim Filename As String
Path = Range("a1").Value
Filename = Dir(Path & "*.xlsm")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
On Error Resume Next
With ActiveWorkbook.Sheets.Name = Range("C1").valu
.Copy After:=ThisWorkbook.Sheets(1)
End With
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub