Posted to microsoft.public.excel.programming
|
|
Combo
It should be easy to work out - if you need help modifying the code, post back. And in any event,
let us know if you succeed or not.
HTH,
Bernie
MS Excel MVP
<Garrett S wrote in message ...
Thanks for the quick reply.
There are 5 attribute sheets in total, but I can modify your code, which looks promising!
Appreciate your input, I'll let you know how it works tomorrow.
Regards,
Garrett
Bernie Deitrick wrote:
Garrett,Is it always three sheets?
21-Jan-10
Garrett,
Is it always three sheets?
Let's say that you have your lists in column A of Sheet1, Sheet2, and Sheet3, and those are the
only
sheets in your workbook. All else is blank. Run the macro below.
HTH,
Bernie
MS Excel MVP
Sub MakeCombos()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim Sh1 As Worksheet
Dim Sh2 As Worksheet
Dim Sh3 As Worksheet
Dim Sh4 As Worksheet
Set Sh1 = Worksheets(1)
Set Sh2 = Worksheets(2)
Set Sh3 = Worksheets(3)
Set Sh4 = Worksheets.Add(After:=Sheets(3))
For i = 1 To Sh1.Cells(Rows.Count, 1).End(xlUp).Row - 1
Sh1.Cells(i + 1, 2).Value = "'" & Format(i, "00")
Next i
For i = 1 To Sh2.Cells(Rows.Count, 1).End(xlUp).Row - 1
Sh2.Cells(i + 1, 2).Value = "'" & Format(i, "00")
Next i
For i = 1 To Sh3.Cells(Rows.Count, 1).End(xlUp).Row - 1
Sh3.Cells(i + 1, 2).Value = "'" & Format(i, "00")
Next i
myC = 1
For i = 1 To Sh1.Cells(Rows.Count, 1).End(xlUp).Row - 1
For j = 1 To Sh2.Cells(Rows.Count, 1).End(xlUp).Row - 1
For k = 1 To Sh3.Cells(Rows.Count, 1).End(xlUp).Row - 1
myC = myC + 1
Sh4.Cells(myC, 1).Value = "'" & Format(i, "00") & _
"_" & Format(j, "00") & "_" & Format(k, "00")
Sh4.Cells(myC, 2).Value = Sh1.Cells(i + 1, 1).Value & _
"_" & Sh2.Cells(j + 1, 1).Value & "_" & Sh3.Cells(k + 1, 1).Value
Next k
Next j
Next i
End Sub
Previous Posts In This Thread:
Submitted via EggHeadCafe - Software Developer Portal of Choice
Implementing Continuous Scrolling UI Pattern in ASP.NET
http://www.eggheadcafe.com/tutorials...tinuous-s.aspx
|