finaljustice
Board Regular
- Joined
- Oct 6, 2010
- Messages
- 175
Hello all,
I have 174 text files that I was able to import into a workbook using VBA. Now my workbook has 174 sheets with the information I need, but I need to compile all that information that is fragmented in many worksheets into one single worksheet. I thought this would be a straight forward code but I keep getting an error.
What I realized is that this line works if I select the sheet it is actively copying:
I am also having issues pasting the information in the "ALL DB" sheet, all this avoiding selecting sheets and activecells, trying to keep my coding as clean as possible. But... apparently I'm missing something very basic.
Thank you for your time and insight.
LF.
I have 174 text files that I was able to import into a workbook using VBA. Now my workbook has 174 sheets with the information I need, but I need to compile all that information that is fragmented in many worksheets into one single worksheet. I thought this would be a straight forward code but I keep getting an error.
Code:
Sub load_db()
For n = 2 To Worksheets.Count
Sheets(n).Range(Cells(11, 1), Cells(1048576, 1).End(xlUp).Offset(-4, 0)).Copy
Sheets("ALL DB").Cells(1048576, 1).End(xlUp).Offset(1, 0).Paste
s
Next
End Sub
What I realized is that this line works if I select the sheet it is actively copying:
Code:
Sheets(n).Range(Cells(11, 1), Cells(1048576, 1).End(xlUp).Offset(-4, 0)).Copy
I am also having issues pasting the information in the "ALL DB" sheet, all this avoiding selecting sheets and activecells, trying to keep my coding as clean as possible. But... apparently I'm missing something very basic.
Thank you for your time and insight.
LF.