- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-1-15 08:51 ½s¿è
¦^´_ 1# afu9240
¦³©µ¦ùªº°ÝÃD¥i¦b³o¥DÃDÄ~Äòªºµo°Ý(¸`¬Ù½×¾Â¸ê·½)
UserForm1 ½Ðקï¦p¤W¹Ï
UserForm1 ¹q¶O¬d¸ßªºµ{¦¡½X- Option Explicit
- Dim ComboBox¤¸¯À(), Sh As Worksheet
- Private Sub UserForm_Initialize()
- MultiPage1.Value = 0
- End Sub
- Private Sub ComboBox4_Change() '¨Ï¥Î³æ¦ì
- ¹q¶O¬d¸ß·Ç«h
- End Sub
- Private Sub ComboBox6_Change() 'p¶O¦a§}
- ¹q¶O¬d¸ß·Ç«h
- End Sub
- Private Sub ComboBox7_Change() 'p¶O¶g´Á
- ¹q¶O¬d¸ß·Ç«h
- End Sub
- Private Sub MultiPage1_Change()
- If MultiPage1.Value = 2 Then ¹q¶O¬d¸ßComboBox
- End Sub
- Private Sub ¹q¶O¬d¸ßComboBox()
- Dim i As Integer, xRng As Range
- ComboBox¤¸¯À = Array(ComboBox4, ComboBox7, ComboBox6) '*** ±±¨î¶µ¸m©ó °}¦C¤¤**
- Set Sh = Sheets("¹q¶O")
- With Sh
- Set xRng = .Cells(1, Columns.Count) '¤u§@ªí³Ì¥kÃ䪺Àx¦s®æ
- For i = 0 To UBound(ComboBox¤¸¯À)
- xRng.EntireColumn.Clear '¾ãÄæ²M°£
- .Columns(i + 1).AdvancedFilter xlFilterCopy, , .Cells(1, Columns.Count), True
- '**¶i¶¥¿z¿ï xlFilterCopy, **(ªÅ¥Õ¬°¤£«ü©w°Ñ¼ÆÈ)** , .Cells(1, Columns.Count), True
- xRng.Cells(Rows.Count).End(xlUp).Offset(1) = "¬d¬Ý¥þ³¡"
- With ComboBox¤¸¯À(i)
- .List = Range(xRng.Cells(2), xRng.Cells(Rows.Count).End(xlUp)).Value
- '** List: ComboBox ©Î ListBox ²M³æªº¨Ó·½,¥i«ü¤u§@ªíÀx¦s®æ½d³òªºÈ
- .Value = .List(.ListCount - 1) '**List³Ì«á¤@Ó¤¸¯À
- End With
- Next
- xRng.EntireColumn.Clear
- End With
- End Sub
- Private Sub ¹q¶O¬d¸ß·Ç«h()
- Dim i As Integer, Msg As Boolean, Rng As Range, Ar()
- Sh.Cells(1, Columns.Count) = ""
- Set Rng = Sh.Cells(1, Columns.Count)
- Ar = Sh.Range("A1:C1").Value '**=Array("¨Ï¥Î³æ¦ì","p¶O¶g´Á","p¶O¦a§}")
- Sheets("¤u§@ªí3").Range("a1").CurrentRegion.Clear
- '**Range.CurrentRegion ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò¡C
- For i = 0 To UBound(ComboBox¤¸¯À)
- If ComboBox¤¸¯À(i).ListIndex > -1 Then
- If Rng.Text <> "" Then Set Rng = Rng.Cells(, 0)
- Rng = Ar(1, i + 1)
- Rng.Cells(2) = ComboBox¤¸¯À(i)
- If ComboBox¤¸¯À(i).ListCount - 1 = ComboBox¤¸¯À(i).ListIndex Then Rng.Cells(2) = "<>"
- '¬d¬Ý¥þ³¡ ®É ·Ç«h±ø¥ó¬° <>
- 'ListCount => 1 ¨ì ¤¸¯ÀªºÁ`¼Æ ,ListIndex =>0 ¤¸¯ÀªºÁ`¼Æ-1
- End If
- Next
- If Rng <> "" Then
- Set Rng = Range(Rng, Rng.End(xlToRight)).Resize(2)
- Sh.Range("a1").CurrentRegion.AdvancedFilter xlFilterCopy, Rng, Sheets("¤u§@ªí3").Range("a1")
-
- End If
- Set Rng = Sheets("¤u§@ªí3").Range("a1").CurrentRegion
- 'RowSource ÄÝ©Ê «ü©w ComboBox ©Î ListBox ²M³æªº¨Ó·½¡C
- With ListBox1
- .RowSource = ""
- .Clear
- .TextAlign = fmTextAlignCenter
- .RowSource = Rng.Address(, , , 1, 1)
- If Rng.Rows.Count > 1 Then
- .ColumnCount = Sh.Range("a1").CurrentRegion.Columns.Count '«ü©wÅã¥ÜªºÄæ¦ì¼Æ
- .RowSource = Sheets("¤u§@ªí3").Range("a1").CurrentRegion.Address(, , , 1, 1)
- .Font.Size = 12
- Else
- .RowSource = ""
- .Font.Size = 48
- .ColumnCount = 1
- .AddItem "¬dµL¸ê®Æ"
- End If
- End With
- End Sub
½Æ»s¥N½X |
|