Hello Guys
Is it possible to convert below code to array?
I believe array is way faster than the code that i have provided.
Thanks in Advance.
Regards
Zelda
Option Explicit
Sub ImportData()
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lCopyLastRow As Long
Dim lDestLastRow As Long
Dim iDirectory As String
Dim iFileName As String
Application.ScreenUpdating = False
iDirectory = "D:\Import\"
iFileName = Dir(iDirectory & "DELIVERY.XLSX")
Workbooks.Open (iDirectory & iFileName)
Set wsCopy = Workbooks("DELIVERY.XLSX").Worksheets(1)
Set wsDest = ThisWorkbook.Worksheets("SAMPLE")
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "A").End(xlUp).Row
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "c").End(xlUp).Offset(1).Row
wsCopy.Range("A2:P" & lCopyLastRow).Copy _
wsDest.Range("C" & lDestLastRow)
Workbooks(iFileName).Close
iFileName = Dir()
Columns(3).Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Columns(4).Select
With Selection
.NumberFormat = "dd-mmm-yy;@"
.Value = .Value
End With
Columns(7).Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Columns(18).Select
With Selection
.NumberFormat = "General"
.Value = .Value
End With
Application.ScreenUpdating = True
End Sub
Bookmarks