starsky
08-25-2009, 07:31 AM
Hi,
I've created a workbook that will collate data from a number of other workbooks. The code for this purpose is working on the whole. The macro opens and extracts data (below header row) from all workbooks in a specific folder.
One problem I am encountering is when there is only a single used row below the header row. Excel won't select just that row but all blank rows too. Subsequently the data is not being transfered in this instance.
This is the code I'm using so far. 'Master' is the workbook to which code is being pasted.
Range("A12:I12").Select
Range(Selection, Selection.End(xlDown)).Copy
Workbooks("Master").Sheets("Data").Activate
Range("A2").Select
'finds next blank row, pastes, etc
If Range("A2") = "" Then
ActiveSheet.Paste
Else
Selection.End(xlDown).Select
With ActiveCell
Cells(.Row + 1, .Column).Select
End With
ActiveSheet.Paste
End If
Any tips would be great.
Thanks.
I've created a workbook that will collate data from a number of other workbooks. The code for this purpose is working on the whole. The macro opens and extracts data (below header row) from all workbooks in a specific folder.
One problem I am encountering is when there is only a single used row below the header row. Excel won't select just that row but all blank rows too. Subsequently the data is not being transfered in this instance.
This is the code I'm using so far. 'Master' is the workbook to which code is being pasted.
Range("A12:I12").Select
Range(Selection, Selection.End(xlDown)).Copy
Workbooks("Master").Sheets("Data").Activate
Range("A2").Select
'finds next blank row, pastes, etc
If Range("A2") = "" Then
ActiveSheet.Paste
Else
Selection.End(xlDown).Select
With ActiveCell
Cells(.Row + 1, .Column).Select
End With
ActiveSheet.Paste
End If
Any tips would be great.
Thanks.