Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on code to sample data

I am in Excel 2010.

Working with very large data files generating samples for different managers .

I have my data in the Details tab of a spreadsheet the Managers Names are in C1 and to the end of column c & the employees Names are in D1 and scroll down...

In order to get my sample I run the sampler macro below.

In this macro I enter the n value that is the total number of the rows in the data. This data can contain data for multiple managers and their employees.

I then enter the Step value. which is give to me .
This could be like 2.5 or 23.7 or 4 or 110 it could be any number.

Issue is that I must have a sample of a minimum of two employees for each manager.

This sampler macro does not guarantee me a sample of at least two sample each for every employee Can this be fixed by modifying the code in the sampler macro below?

Thanks in advance, appreciate any enhancement of the code below as I am not a programmer.



Sub Sampler()
Source_Sheet = "Source"
Target_Sheet = "Target"


n = 2919 ' your last line of data on Sheet1
Target_Row = 1
Sheets(Target_Sheet).Select
For nCount = 1 To n Step 130 ' Enter the Sample Interval


Worksheets(Source_Sheet).Cells(nCount, 1).EntireRow.Copy
Worksheets(Target_Sheet).Cells(Target_Row, 1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Target_Row = Target_Row + 1
Next


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Help on code to sample data

Hi

Not sure if this will help or not, but! You could try this link which is for a random number generator.

You may be able to reconfigure it to select employees instead of numbers.

https://www.get-digital-help.com/201...tery-in-excel/

HTH
Mark.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help on code to sample data

thanks Mark
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sample code malik Excel Programming 1 May 29th 08 01:16 PM
Any sample code to verify data? ron Excel Programming 4 November 21st 06 07:10 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM
Need sample code Sandy Excel Programming 2 August 31st 05 12:47 PM
Need Sample VBA Code Bill Sturdevant[_2_] Excel Programming 3 January 26th 05 10:25 PM


All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"