how do I copy every 2nd row
A macro will this for you
Option Explicit
Sub every5thRow()
Const WORKSHEET_NAME As String = "Sheet1"
Dim x As Long, i
x = 0
i = 1
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(WORKSHEET_NAME)
Dim rng As Range
Set rng = ws.Range(ws.Cells(1, "A"), ws.Cells(Rows.Count, "A").End(xlUp))
Dim arrnoedimensional() As Variant
ReDim arrnoedimensional(1 To rng.Cells.Count)
Dim Cell As Range
For Each Cell In rng
If i Mod 5 = 0 Then
x = x + 1
arrnoedimensional(x) = Cell.Value
End If
i = i + 1
Next
Workbooks.Add
Dim wb As Workbook
Set wb = ActiveWorkbook
ReDim Preserve arrnoedimensional(1 To x)
i = 2
Dim strValue As Variant
For Each strValue In arrnoedimensional
wb.Worksheets(1).Range("A" & i).Value = strValue
i = i + 1
Next
End Sub
"Chris H" wrote:
I have rows of information (mailing list). I would like to copy every 5th
row only to a new workbook using transpose without having to highlight every
5th entry. Is this possible?
|