LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Create an Array that includes every possible combination for 4 gro

Bob,

something like this would put all possible combinations of values in columns
A to D in column E.

Sub test()
Dim colA As Range, cellA As Range
Dim colB As Range, cellB As Range
Dim colC As Range, cellC As Range
Dim colD As Range, cellD As Range
Dim lRow As Long

Set colA = Range(Range("A2"), Range("A65535").End(xlUp))
Set colB = Range(Range("B2"), Range("B65535").End(xlUp))
Set colC = Range(Range("C2"), Range("C65535").End(xlUp))
Set colD = Range(Range("D2"), Range("D65535").End(xlUp))

lRow = 2
For Each cellA In colA
For Each cellB In colB
For Each cellC In colC
For Each cellD In colD
Range("E" & lRow).Value = cellA.Text & cellB.Text &
cellC.Text & cellD.Text
lRow = lRow + 1
Next cellD
Next cellC
Next cellB
Next cellA
End Sub


--
Hope that helps.

Vergel Adriano


"Bob K" wrote:

Using the following codes below I am trying to create an excel file that
contains ever possible combination for the four groups. For example: X22E,
X11G, C211 V21G. Any help would be much appreciated in developing a macro to
accomplish this.

thanks,

bob


Class Form Pricing Group
X 1 1 G
C 2 2 E
V 3 3 I
D 4 M
M N
R F

 
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
combination of AutoFilter and array formula? mark Excel Worksheet Functions 5 June 30th 07 09:44 PM
Combination of functions for a conditional format and an array [email protected] Excel Worksheet Functions 0 March 8th 05 06:06 AM
Create a "recap" worksheet that includes all info from all worksh. tdglaw Excel Worksheet Functions 1 February 2nd 05 04:48 PM
Creating a Combination or Permutation Array in Excel D.L. Excel Programming 4 November 1st 04 05:32 PM
Code to create Email that includes quotes Jeremy Gollehon[_2_] Excel Programming 4 May 12th 04 06:53 PM


All times are GMT +1. The time now is 04:48 AM.

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"