macro to select and copy rows only containing data
Here is a crude macro without any error checking..
===============
Sub CopyNonBlankRows()
Dim i As Long
Dim j As Long
Dim dest As String
Dim src As String
j = 1
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
' Change 10 to your last row or max row possible
For i = 1 To 10
' Change X to the last column or max cols possible
src = "A" & i & ":X" & i
'Assumptions - Sheet1 contain the data and Sheet2 is the destination sheet
Sheets("Sheet1").Activate
ActiveSheet.Range(src).Select
If (WorksheetFunction.CountA(Selection.Rows(1)) 0) Then
ActiveSheet.Rows(i).EntireRow.Select
Selection.Copy
dest = "A" & j
Sheets("Sheet2").Activate
ActiveSheet.Range(dest).Select
ActiveSheet.Paste
j = j + 1
End If
Next i
..Calculation = xlCalculationAutomatic
..ScreenUpdating = True
End With
End Sub
===============
"shaz0503" wrote:
All
Have searched various forums and can't seem to find what I need. Is really
simple and I know can be done but...
I need to be able to select all rows containing data and then copy and paste
to new sheet - would like the code that selects these rows only.
TIA
Shaz
|