Jeffreyxx01
Board Regular
- Joined
- Oct 23, 2017
- Messages
- 156
Hi guys,
I need some help on updating my macro,
When I will click on the macro using this one below, I will want to pull the name of the intern and copy automatically in the column A for the number of rows that the intern created on his/her spreadsheet,
I have a lookup table of the name of the intern which can be used to just click on the name to be filled.
the name of the other tab is: Lookups and the name range is A2:A25
Thanks for your help,
I need some help on updating my macro,
When I will click on the macro using this one below, I will want to pull the name of the intern and copy automatically in the column A for the number of rows that the intern created on his/her spreadsheet,
I have a lookup table of the name of the intern which can be used to just click on the name to be filled.
the name of the other tab is: Lookups and the name range is A2:A25
Thanks for your help,
Code:
Sub OpenFiles()
Dim InitPth As String
Dim Wbk As Workbook
Dim Cnt As Long
Dim Sht As Worksheet
Dim Usdrws As Long
InitPth = "C:\Users\Hosue\Desktop\PE\Master List\Inputs"
With Application.FileDialog(3)
.Title = "Select the files"
.AllowMultiSelect = True
.InitialFileName = InitPth
If .Show <> -1 Then Exit Sub
For Cnt = 1 To .SelectedItems.Count
Set Wbk = Workbooks.Open(.SelectedItems(Cnt))
Set Sht = ThisWorkbook.Sheets("DataBase")
With Wbk.Sheets("CallSheet")
LastRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
.Range("A2:L" & LastRow).Copy Sht.Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
Application.DisplayAlerts = False
Wbk.Close , False
Application.DisplayAlerts = True
Next Cnt
End With
End Sub