ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I create a sample in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/34981-how-do-i-create-sample-excel.html)

Mary

How do I create a sample in Excel?
 
I am trying to create a sample, needing every 20th record out of around 3000
records.

Chip Pearson

Mary,

You need a VBA procedure.

Sub AAA()
Dim RowNdx As Long
Dim DestRng As Range
Set DestRng = Worksheets("Sheet2").Range("A1")
For RowNdx = 1 To 3000 Step 20
Rows(RowNdx).Copy Destination:=DestRng
Set DestRng = DestRng(2, 1)
Next RowNdx
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Mary" wrote in message
...
I am trying to create a sample, needing every 20th record out of
around 3000
records.





All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com