´äº¯ °¨»çµå¸³´Ï´Ù..
¿ÀÇ °³¼ö¸¦ 16°³·Î ÀâÀ»·Á°í Çϴµ¥... ¾î¶°ºÎºÐÀ» °íÃľßÇÏ´ÂÁö ¾Æ¹«¸® °íÃĺÁµµ ¿ÏµÇ³×¿ä...
Option Explicit Dim i As Integer
Private Sub UserForm_Initialize() Dim rngDb As Database Dim rngRs(1 To 16) As Recordset Dim stSQL(1 To 16) As String Dim arrVar As Variant arrVar = Array("±¸ºÐ", "AREA", "MAKER", "MODEL", "»óÅÂ", "ÇØ´ç³âµµ") Set rngDb = OpenDatabase(ThisWorkbook.FullName, False, False, "Excel 8.0;") For i = 1 To 6 stSQL(i) = "SELECT DISTINCT " & arrVar(i - 1) & " FROM [µ¥ÀÌÅÍ$] " Set rngRs(i) = rngDb.OpenRecordset(stSQL(i)) Do While Not rngRs(i).EOF With Me.Controls("ComboBox" & i) .AddItem rngRs(i)(0): rngRs(i).MoveNext: .ListIndex = 0 End With Loop Next i End Sub
Private Sub CommandButton1_Click() Dim rngCell As Range, rngArea As Range Dim strCombo As String Dim c As Integer, r As Integer Application.ScreenUpdating = False Set rngArea = Sheet2.Range("a1").CurrentRegion ListBox1.Clear For i = 1 To 6 strCombo = Me.Controls("ComboBox" & i).Value rngArea.AutoFilter i + 1, strCombo, , , 0 Next i For Each rngCell In rngArea.Columns(1).SpecialCells(12) With ListBox1 .AddItem rngCell For c = 1 To 15 .List(r, c) = rngCell.Offset(0, c) Next c End With r = r + 1 Next rngCell rngArea.AutoFilter Application.ScreenUpdating = True End Sub
´äº¯±â´Ù¸®°Ú½À´Ï´Ù....
|