ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

VBA §ì¨úListBox¤¤ªº¤º®e

¦^´_ 52# samwang
§Ú«á¨Óª½±µ¦bdbl_Click
¤U¤FUnload
¦A¤Ushow
§âform­«·sshow¤@¦¸
´N¥i¥H¤F
¥i¥H¤@¦¸¦h¿ï¡A¿ï§¹2­Ó¾÷¥x«á¦blistbox¸ÌªºªÅ¥Õ³BÂI¨â¤U´N¦n¤F

TOP

¦^´_ 51# wang077


±z´£¨Ñªºµ{¦¡¦³°ÝÃD¡Aµ{¦¡¥»¨ÓListbox ³]©w¬°change¡A²{¦b§A¤S¦P®É³]©w¬°Listbox_DblClick
³o¼Ë¤£¦æ·|½Ä¬ð¡A¦Ó¥BDblClick¥u¯à³æ¿ï¡A¦n¹³¦³©M¤§«eªº»Ý¨D¤S¤£¤@¼Ë¡AÁÂÁ¡C

­ìµ{¦¡¬[ºc: listbox ³]¬°½Æ¿ï¡A¿ï¾Ü¾÷¸¹¡A¾÷¸¹¼È¦sAr¼Æ²Õ-->¥Îcommandbutton °õ¦æ°j°éAr¥h°µ½Æ»s°Ê§@

TOP

¦^´_ 50# samwang
·J¾ã_0707.zip (117.42 KB)
·s¼W¸ê®Æ§¨.zip (407.42 KB)
³Â·Ð¤j¤j¤F

TOP

¦^´_ 48# wang077


§Ú´ú¸Õ¨S°ÝÃD¡A¥iªþ¥óÅý§Ú´ú¸Õ¬Ý¬Ý¶Ü? ÁÂÁÂ

TOP

¦^´_ 47# s3526369
¦¹°ÝÃD¤w¸Ñ¨M
·PÁ¤À¨É

TOP

¥»©«³Ì«á¥Ñ wang077 ©ó 2021-7-7 10:40 ½s¿è

¦^´_ 44# samwang
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
fileorg = ActiveWorkbook.Name
Set xD = CreateObject("Scripting.Dictionary")
For i1 = 1 To n1
    If Not xD.Exists(Ar(i1, 1) & "") Then
        xD(Ar(i1, 1) & "") = ""
        For i = 1 To n
            If Arr(i, 2) = Ar(i1, 1) Then n2 = n2 + 1: Ar1(n2, 1) = Arr(i, 1)
        Next
    End If
Next
R = 1: Sheets("6¤ë¥÷¼Æ¾Ú").Select
With Sheets("6¤ë¥÷¼Æ¾Ú")
    If .FilterMode Then .ShowAllData
    .Range("a1:AA" & .[a65536].End(3).Row).Delete
    Tm = Timer
    For i1 = 1 To n2
        Set WB = Workbooks.Open(Ar1(i1, 1))
        With Sheets("6¤ë¥÷¼Æ¾Ú")
            If .FilterMode Then .ShowAllData
            fn = Split(ActiveWorkbook.Name, ".")(0)
            .Range("a1:z" & .[a65536].End(3).Row).Copy Workbooks(fileorg).Sheets("6¤ë¥÷¼Æ¾Ú").Range("a" & R)
        End With
        WB.Close
        .Range("U" & R & ":U" & .[a65536].End(xlUp).Row) = fn
        R = .[a65536].End(xlUp).Row + 1
    Next
End With
MsgBox "¸ê®Æ½Æ»s§¹¦¨" & Timer - Tm & "¬í"
Erase Arr: Erase Ar

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.AskToUpdateLinks = True
End Sub

   


¤j¤j¡A§Ú§â½Æ»s¸ê®Æªºµ{¦¡½X¥á¶i¥hListBox1_DblClick¸Ì­±
¥i¥Hª½±µ¿ï¨úListBox¨Ó¥s¥X¸ê®Æ¡A¦ý§Ú¦pªG²Ä¤@¦¸ÂIÀ»¾÷1¥i¥H¥s¥X¾÷1ªº¸ê®Æ¡A§Ú²Ä¤G¦¸ÂIÀ»¾÷2ªº®É­Ô
¥L¤SÅã¥Ü³o¿ù»~¤F
¨D¸Ñ¡I

TOP

¦^´_ 1# wang077
  1. With ListBox1
  2.           .ListStyle = 1  '§Ç«e¤è®Ø®Ø
  3. End With
½Æ»s¥N½X

TOP

¦^´_ 45# wang077
§ä¨ì¿ù»~¤F¡A­è­è§âµ{¦¡ÀÉ©ñ¦A¦P¤@­Ó¸ê®Æ§¨¡A©Ò¥H¥X²{¿ù»~
¥H¸Ñ¨M³o¿ù»~

TOP

¦^´_ 44# samwang
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
fileorg = ActiveWorkbook.Name
Set xD = CreateObject("Scripting.Dictionary")
For i1 = 1 To n1
    If Not xD.Exists(Ar(i1, 1) & "") Then
        xD(Ar(i1, 1) & "") = ""
        For i = 1 To n
            If Arr(i, 2) = Ar(i1, 1) Then n2 = n2 + 1: Ar1(n2, 1) = Arr(i, 1)
        Next
    End If
Next
R = 1: Sheets("6¤ë¥÷¼Æ¾Ú").Select
With Sheets("6¤ë¥÷¼Æ¾Ú")
    If .FilterMode Then .ShowAllData
    .Range("a1:AA" & .[a65536].End(3).Row).Delete
    Tm = Timer
    For i1 = 1 To n2
        Set WB = Workbooks.Open(Ar1(i1, 1))
        With Sheets("6¤ë¥÷¼Æ¾Ú")
            If .FilterMode Then .ShowAllData
            fn = Split(ActiveWorkbook.Name, ".")(0)
            .Range("a1:z" & .[a65536].End(3).Row).Copy Workbooks(fileorg).Sheets("6¤ë¥÷¼Æ¾Ú").Range("a" & R)
        End With
        WB.Close
        .Range("U" & R & ":U" & .[a65536].End(xlUp).Row) = fn
        R = .[a65536].End(xlUp).Row + 1
    Next
End With
MsgBox "¸ê®Æ½Æ»s§¹¦¨" & Timer - Tm & "¬í"
Erase Arr: Erase Ar
Unload Me

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.AskToUpdateLinks = True

½Æ»s¸ê®Æªº®É­Ô
Set WB = Workbooks.Open(Ar1(i1, 1))
³o¦æ¥X²{¤F¿ù»~

TOP

¦^´_ 43# wang077

´£¨Ñ2ºØ¤èªk¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ

Private Sub UserForm_Activate()
Dim fs, f, fc, xD, a
Set fs = CreateObject("Scripting.FileSystemObject")
Set xD = CreateObject("Scripting.Dictionary")
'a = ThisWorkbook.Path  'µ{¦¡ÀÉ»P¸ê®ÆÀÉ©ñ¦P¤@­Ó¸ê®Æ§¨
a = "D:\test"                       '¸ê®ÆÀÉ©ñ¦b©T©w¸ô®|
fnorg = ActiveWorkbook.Name
Set f = fs.GetFolder(a)
Set fc = f.Files
For Each f1 In fc
    n = n + 1
    If InStr(f1.Path, fnorg) Then GoTo 99
    Arr(n, 1) = f1.Path
    Arr(n, 2) = Split(f1.Name, ".")(0)
    xD(Arr(n, 2) & "") = ""
99: Next
Me.ListBox1.List = xD.keys
Set fs = Nothing: Set f = Nothing: Set fc = Nothing: Set xD = Nothing
EndSub:
End Sub

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD