Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Generate a combination list of values

Using Office 2003 and Windows XP;

Picture 3 columns of values from 167 to 212; each value incrementing by 3.
Thus:

167 167 167
170 170 170
173 173 173
176 176 176
179 179 179
....

See above, except that each column goes up to 212; this gives a spread or
range of 16 values in each column.

I need a macro that will generate a list of these values in every possible
combination with one another (16 * 16 * 16 = 4096 combinations - I think).

Anyone got a clue how to do this, or has someone out there got some VBA code
they can post?

Thanks so much in advance for your assistance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Generate a combination list of values

Try the macro below.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim r As Long

r = 2

For i = 167 To 212 Step 3
For j = 167 To 212 Step 3
For k = 167 To 212 Step 3
Cells(r, 1).Value = i
Cells(r, 2).Value = j
Cells(r, 3).Value = k
r = r + 1
Next k
Next j
Next i

End Sub

"XP" wrote in message
...
Using Office 2003 and Windows XP;

Picture 3 columns of values from 167 to 212; each value incrementing by 3.
Thus:

167 167 167
170 170 170
173 173 173
176 176 176
179 179 179
...

See above, except that each column goes up to 212; this gives a spread or
range of 16 values in each column.

I need a macro that will generate a list of these values in every possible
combination with one another (16 * 16 * 16 = 4096 combinations - I think).

Anyone got a clue how to do this, or has someone out there got some VBA code
they can post?

Thanks so much in advance for your assistance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Generate a combination list of values

I'm sure you don't know, but you've helped me out before and I always
appreciate your help.

Nice neat solution; I was making it so much more complex.

Thanks so much and have a great day.

"Bernie Deitrick" wrote:

Try the macro below.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim r As Long

r = 2

For i = 167 To 212 Step 3
For j = 167 To 212 Step 3
For k = 167 To 212 Step 3
Cells(r, 1).Value = i
Cells(r, 2).Value = j
Cells(r, 3).Value = k
r = r + 1
Next k
Next j
Next i

End Sub

"XP" wrote in message
...
Using Office 2003 and Windows XP;

Picture 3 columns of values from 167 to 212; each value incrementing by 3.
Thus:

167 167 167
170 170 170
173 173 173
176 176 176
179 179 179
...

See above, except that each column goes up to 212; this gives a spread or
range of 16 values in each column.

I need a macro that will generate a list of these values in every possible
combination with one another (16 * 16 * 16 = 4096 combinations - I think).

Anyone got a clue how to do this, or has someone out there got some VBA code
they can post?

Thanks so much in advance for your assistance.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Generate a combination list of values

It is hard to keep track of usernames that aren't real names (like XP), but I'm always glad to help,
and I'm always happy to hear that my suggestions worked, so thanks for the feedback.

Bernie
MS Excel MVP


I'm sure you don't know, but you've helped me out before and I always
appreciate your help.

Nice neat solution; I was making it so much more complex.

Thanks so much and have a great day.



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 generate new list in another worksheet from existing list? NSF Excel Worksheet Functions 0 September 24th 08 01:08 PM
How to get all number combination from a list Tom Ogilvy Excel Programming 1 April 12th 07 11:05 AM
Need to generate random values from a list Sumeet Benawra Excel Discussion (Misc queries) 2 July 13th 06 12:13 PM
How do I generate a list from a range of values robo7084 Excel Worksheet Functions 2 July 6th 06 01:48 AM
Calling (Function?) from Userform_Initialize to generate list of unique values for Combo box Alan Excel Programming 2 July 23rd 04 05:40 AM


All times are GMT +1. The time now is 02:49 PM.

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

About Us

"It's about Microsoft Excel"