Created
July 23, 2015 12:03
-
-
Save chrisvoncsefalvay/246ef1524b542aebd6be to your computer and use it in GitHub Desktop.
Cartesian Product for Kath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub cartesianproduct() | |
| Dim startrange As Range | |
| range1 = Application.InputBox(Prompt:="Please Select First Range", Type:=8) | |
| range2 = Application.InputBox(Prompt:="Please Select Second Range", Type:=8) | |
| Set startrange = Application.InputBox(Prompt:="Please select where you want to put it", Type:=8) | |
| array1 = [range1] | |
| array2 = [range2] | |
| startrange.Select | |
| For i = 1 To UBound(array1) | |
| For x = 1 To UBound(array2) | |
| z = z + 1 | |
| ActiveCell.Offset(z, 0).Value = array1(i, 1) | |
| ActiveCell.Offset(z, 1).Value = array2(x, 1) | |
| Next | |
| Next | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment