LearnExcel&VBA
Member
Hi i have below code i am using this on excel 2016 it is working fine but when run this code on 2019 it does not work.
Code:
Sub Exce20192016()
Dim xFd As FileDialog
Dim xFdItem As Variant
Dim xFileName As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set xFd = Application.FileDialog(msoFileDialogFolderPicker)
If xFd.Show = -1 Then
xFdItem = xFd.SelectedItems(1) & Application.PathSeparator
xFileName = Dir(xFdItem & "*.csv*")
Dim xCount As Integer
xCount = Application.InputBox("Number of Rows", "Kutools for Excel", , , , , , 1)
Do While xFileName <> ""
With Workbooks.Open(xFdItem & xFileName)
Dim I As Long
LableNumber:
If xCount < 1 Then
GoTo LableNumber
End If
For I = Range("A" & Rows.CountLarge).End(xlUp).Row To 2 Step -1
Rows(I).Copy
Rows(I).Resize(xCount).Insert
Next
Application.CutCopyMode = False
End With
xFileName = Dir
Loop
End If
Dim wb As Workbook
For Each wb In Workbooks
wb.Close SaveChanges:=True
Next wb
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub