- ©«¤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
|
¦^´_ 16# Michelle-W
¾ã²z¤@¤U§Aªºµ{¦¡½X
¥i¤F¸Ñ¬Ý¬Ý- Option Explicit
- Dim Rng As Range, Msg As Boolean
- Private Sub UserForm_Initialize()
- Msg = MsgBox("ListBox ²M³æªº¨Ó·½¡C" & vbLf & "Yes=¨Ï¥ÎRowSource" & vbLf & "No= ¨Ï¥ÎList(°}¦C)", vbYesNo) = vbYes
- ListB1
- End Sub
- Public Sub ListB1()
- Dim RO As Integer
- With Sheet2
- RO = IIf(.Cells(Rows.Count, 1).End(xlUp).Row > 2, .Cells(Rows.Count, 1).End(xlUp).Row, 2)
- Set Rng = .Range("A2:A" & RO)
- End With
- With ListBox1
- .MultiSelect = fmMultiSelectMulti
- If Msg Then
- .RowSource = Rng.Address(, , , 1, 1)
- Else
- .List = Rng.Value
- End If
- .ColumnCount = Rng.Columns.Count
- End With
- End Sub
- Private Sub ·s¼W_Click()
- '¿é¤Jªº¸ê®Æ¦^¶Ç¦ÜÀx¦s®æ°O¿ý
- Dim RO As Integer
- With Sheet2
- RO = .[A65536].End(xlUp).Row + 1
- .Cells(RO, 1) = TextBox1.Value
- TextBox1.Value = ""
- ListB1 '«³] ListBox1
- End With
- End Sub
- Private Sub §R°£_Click()
- Dim i As Integer, r As String, E As Variant
- For i = home.ListBox1.ListCount - 1 To 0 Step -1
- If home.ListBox1.Selected(i) = True Then
- If Msg = False Then '**ListBox ²M³æªº¨Ó·½¡CNo= ¨Ï¥ÎList(°}¦C)
- home.ListBox1.RemoveItem (i)
- ElseIf Msg = True Then '**ListBox ²M³æªº¨Ó·½¡CYes=¨Ï¥ÎRowSource
- r = IIf(r <> "", r & "," & i + 1, i + 1)
- End If
- End If
- Next
- If Msg = True Then
- For Each E In Split(r, ",")
- Rng.Rows(E).Delete '**§R°£½d³ò¤¤ªº¸ê®Æ Yes=¨Ï¥ÎRowSource
- Next
- ListB1
- End If
- End Sub
- Private Sub ¶×¤J_Click()
- Dim AA, xi As Integer
- With ListBox1
- For xi = 0 To .ListCount - 1
- ' §PÂ_¦Cªí®Ø (ListBox1) ¬O§_¦³³QÂI¿ï
- If .Selected(xi) = True Then
- ' ¨ú¥X¸Ó¦æ¤§¼Æ¾Ú¡A¦s¤J AA °}¦C¤¤
- AA = Application.Index(ListBox1.List, xi + 1)
- 'With Sheets("sheet3").Range("A" & Rows.Count).Offset(1) '.Offset(1) '**ÁÙ¬O¤U¤@Àx¦s®æ
- With Sheets("sheet3").Range("A" & Rows.Count).End(xlUp).Offset(1) '.Offset(1) '**ÁÙ¬O¤U¤@Àx¦s®æ
- .Cells = .Cells + AA
- 'ÁÙ¬O .Cells = .Cells + AA '¸ê®Æ¬O²Ö¿nªº
- End With
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X |
|