Hello,
I've been using VBA for a while and I have a great combine formula which i will usually used after i have GET SHEETS however it seems to be rewriting the top line on the next spreadsheet of the last line of the previous.
So if i have sheet one with 10 rows of data and sheet 2 with 5 rows of data on my combined tab i will only have 14. I would attach a spreadsheet to show this but i am new and worried i'll get it wrong.
I have only noticed this when running the GET SHEETS with CSV's but the majority of the work I do is with CSV's so i'm thinking its something in the code.
Sub Combine()
'UpdatebyExtendoffice20180205
Dim I As Long
Dim xRg As Range
On Error Resume Next
Worksheets.Add Sheets(1)
ActiveSheet.Name = "Combined"
For I = 2 To Sheets.Count
Set xRg = Sheets(1).UsedRange
If I > 2 Then
Set xRg = Sheets(1).Cells(xRg.Rows.Count + 1, 1)
End If
Sheets(I).Activate
ActiveSheet.UsedRange.Copy xRg
Next
End Sub
Hope someone can advise what i'm doing wrong,
Thanks
Meg
Bookmarks