Home > Software engineering >  The same folder multiple workbook first batch entry in the table corresponding workbook
The same folder multiple workbook first batch entry in the table corresponding workbook

Time:09-16

The great god! In a folder under the how to book the first batch to multiple file added a content area in the sheet corresponding workbook name

CodePudding user response:

Is a batch to have content areas define name

CodePudding user response:

 

Sub findXLS ()

Dim curDir As String, xlsxName As String, fileType As String

FileType="\ *. XLSX"
CurDir=Application. ActiveWorkbook. Path

XlsxName=Dir (curDir & amp; FileType)

Application. DisplayAlerts=False
Application. ScreenUpdating=False

Dim RNG As Range

The Do While xlsxName & lt; & gt; "
"
Workbooks. Open fileName:=curDir + "" + xlsxName
The Set of RNG=ActiveWorkbook. ActiveSheet. UsedRange

If RNG. Count & lt; & gt; 0 Then
'the Debug. Print RNG (1, 1)
RNG (1, 1)=xlsxName
End the If

ActiveWorkbook. Close SaveChanges:=True

XlsxName=Dir

Loop
Application. ScreenUpdating=True

End Sub
  •  Tags:  
  • VBA
  • Related