Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros or functions

Is there existing macros or functions that I can perform the following
sampling logic?

I have a file with 500K transactions. Would like to start with a number and
select one transaction every 30 records. The total number of selected
transactions are 2000.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Macros or functions

Assuming records are in each row and the first record is in cell A1,
try something like:

Sub Sample2000Step30()
Dim i As Integer
For i = 1 To 2000
Cells(i * 30, 1).Select
'your code here
Next i
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros or functions


Milo,

Do you really mean *500k *transactions? If so you'll probably have t
wait till Excel12 which will accomodate that number with another 500
to spare.

But if you still want to force the issue you may want to spread you
data over 8 worksheets and then adjust your looping code thus:
Sub N()

Sub m()

For i = 1 To 500000 Step 30

j = i \ 65336

Sheets(j + 1).Cells(i, 2).select

Next
End Sub

Myle

--
Myle
-----------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...fo&userid=2874
View this thread: http://www.excelforum.com/showthread.php?threadid=52294

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros or functions


Sorry, my code is modified to:

Sub m()

For i = 1 To 500000 Step 30

j = i \ 65336
n = i Mod 65536

Sheets(j + 1).Cells(n, "A").select
<Do whatever

Next

End Sub

Tried and tested.

Myles

--
Myle
-----------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...fo&userid=2874
View this thread: http://www.excelforum.com/showthread.php?threadid=52294

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
How do I combine MACROS and functions? Mr_Crowe New Users to Excel 1 July 9th 08 02:23 AM
macros with functions Robert Excel Worksheet Functions 3 March 21st 08 02:00 PM
Excel Functions and Macros Rich Excel Discussion (Misc queries) 2 December 22nd 05 03:55 PM
Finding MACROs and FUNCTIONs Tom Excel Worksheet Functions 0 October 12th 05 02:15 PM
Macros and IF Functions Keri[_2_] Excel Programming 1 April 20th 04 04:50 PM


All times are GMT +1. The time now is 06:29 PM.

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"