I am trying to run the below mentioned code to import .xls files from a folder into one workbook but separate worksheets, but failing as a bug is affecting this code, where only first 50 rows are coming up in each tab of workbook. Any suggestions what to do next or how to modify the code.
Sub test() Dim myFile As String, sh As Worksheet, myRange As Range Const myPath = "C:\Test Folder\" ' to be modified Workbooks.Add 1 Set sh = ActiveWorkbook.ActiveSheet myFile = Dir(myPath & "*.xlsx") Do While myFile <> "" Workbooks.Open myPath & myFile Rows(1).Copy sh.Rows(1) Set myRange = ActiveSheet.UsedRange Set myRange = myRange.Offset(1).Resize(myRange.Rows.Count - 1) myRange.Copy sh.Range("A1048576").End(xlUp).Offset(1) Workbooks(myFile).Close False myFile = Dir Loop End Sub
Welcome to OZ Grid
Please use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window.
I’ve added them this time but please comply in the future