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

[µo°Ý] Ū¨ú¤ÎÂkÃþ¸ê®Æ

¡Õ°e³f³æ¡Ö

Sub ¨ú¥X¸ê®Æ()
Dim Arr, Xrr, Yrr, i&, j%, V, T$, T1$, TR, x&, y&
Call ²M°£¸ê®Æ
Arr = Range([L1], [A65536].End(xlUp).MergeArea)
ReDim Xrr(1 To UBound(Arr), 1 To 7)
ReDim Yrr(1 To UBound(Arr), 1 To 4)
For i = 15 To UBound(Arr)
    T = Arr(i, 1): V = Val(Arr(i, 10))
    If T Like "*L *W *H *" Then
       TR = Split(T, Chr(10)): T1 = Trim(TR(0))
       x = x + 1
       Xrr(x, 1) = T  'A Ä榳¤Ø¤oªº¼Æ¾Ú
       Xrr(x, 2) = T1 '³f¬[¸¹
       Xrr(x, 3) = Arr(i, 2) 'N.W.(²b­«)
       Xrr(x, 4) = Arr(i, 3) 'G.W.(¤ò­«)
       Xrr(x, 5) = Val(Mid(TR(3), 2)) 'W
       Xrr(x, 6) = Val(Mid(TR(2), 2)) 'L
       Xrr(x, 7) = Val(Mid(TR(4), 2)) 'H
    End If
    '----------------------------------
    If T1 <> "" And Arr(i, 6) <> "" And V <> 0 Then
       y = y + 1
       Yrr(y, 1) = T1 '³f¬[¸¹
       Yrr(y, 2) = Arr(i, 7) '¦ì¸m
       Yrr(y, 3) = Arr(i, 6) '¤º®e
       Yrr(y, 4) = V '¼Æ¶q
    End If
i01: Next i
If x = 0 Then Exit Sub
With [N3].Resize(x, 7)
     .Value = Xrr
     .Borders.LineStyle = 1
     .WrapText = False
End With
With [v3].Resize(y, 4)
     .Value = Yrr
     .Borders.LineStyle = 1
End With
End Sub

Sub ²M°£¸ê®Æ()
Range([T3], [N65536].End(xlUp)(3)).Delete Shift:=xlUp
Range([Y3], [V65536].End(xlUp)(3)).Delete Shift:=xlUp
End Sub

TOP

¦^´_ 12# ­ã´£³¡ªL
¦]爲Ác²Åé°ÝÃD¡A¾É­P¶Ã½X¡A¾É­PµLªk¹B¦æ¡C ¦]爲¨S¦³­ì¤å¡A§ÚµLªk­×¥¿¶Ã½X³¡¤À¡C¥i§_µo¤@¤U­ì¤åµ¹§Ú­×¥¿¡C

Sub ╊ÇG()
Attribute ╊ÇG.VB_Description = "Å÷场Ò§  2024/1/1 »íÐFǤ栋"
Attribute ╊ÇG.VB_ProcData.VB_Invoke_Func = " \n14"
Dim Arr, Brr, Drr, Xrr, Yrr, xD, xS As Worksheet, vS As Worksheet, R&, S$, T$, i&, j&, k%, x&, y%, N&
Call ®J
Set xD = CreateObject("Scripting.Dictionary")
Set vS = Sheets("¹G琜"): Xrr = vS.[a8:f8]
Arr = Range(vS.[b1], vS.[d65536].End(xlUp))
For i = 9 To UBound(Arr)
    T = Arr(i, 2)
    If T Like "SR####" Then xD(T) = vS.Cells(i, 2).MergeArea.Resize(, 5).Value
Next i
'-----------------------------
Set xS = Sheets("BF")
Arr = Range(xS.[f1], xS.[a65536].End(xlUp).MergeArea)
For i = 2 To UBound(Arr)
    If Arr(i, 1) Like "BF祘[#]###*" Then
       S = Mid(Arr(i, 1), 5, 4): N = 0
       Brr = xS.Cells(i, 1).MergeArea.Resize(, 5).Value
       ReDim Yrr(1 To 2000, 1 To 6)
       N = N + 1
       For y = 1 To 6: Yrr(N, y) = Xrr(1, Mid(123645, y, 1)): Next
       For j = 1 To UBound(Brr)
           For k = 2 To UBound(Brr, 2)
               If Brr(j, k) Like "*琜*SR####*" Then
                  T = Mid(Brr(j, k), 4, 6)
                  Drr = xD(T)
                  If IsArray(Drr) Then
                     For x = 1 To UBound(Drr)
                         N = N + 1
                         Yrr(N, 1) = "=row()-1"
                         Yrr(N, 2) = Drr(1, 1)
                         Yrr(N, 3) = Drr(1, 2)
                         Yrr(N, 4) = Drr(1, 5)
                         Yrr(N, 5) = Drr(1, 3)
                         Yrr(N, 6) = Drr(1, 4)
                     Next x
                  End If
               End If
           Next k
       Next j
       '-----------------------------------
       If N <= 1 Then GoTo i01
       Set vS = Sheets.Add(after:=vS): vS.Name = S
       With vS.[a1].Resize(N, 6)
            .Value = Yrr
            .Borders.LineStyle = 1
            .Sort Key1:=.Item(3), Order1:=xlAscending, _
                  Key2:=.Item(4), Order2:=xlAscending, _
                  Key3:=.Item(2), Order3:=xlAscending, Header:=xlYes
            T = "'" & S & "'!" & .Address
       End With
       '-----------------------------------
       ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=T).CreatePivotTable TableDestination:=vS.Range("i1"), TableName:="Pvt_1"
       vS.PivotTables("Pvt_1").AddFields RowFields:=vS.Range("C1"), ColumnFields:=vS.Range("d1")
       vS.PivotTables("Pvt_1").PivotFields(vS.Range("F1").Text).Orientation = xlDataField
    End If
    Application.CommandBars("PivotTable").Visible = False
i01: Next i
End Sub

Sub ®J()
Dim xS As Worksheet
Application.DisplayAlerts = False
For Each xS In Sheets
    If xS.Name Like "[#]###" Then xS.Delete
Next
End Sub


Sub ttt()
MsgBox Val("11 22")
End Sub
Sub Macro2()
'
' Macro2 Ǥ栋
' Å÷场Ò§  2024/1/1 »íÐFǤ栋
'

'
'   Columns("B:F").Select
  ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="'#001'!C1:f86").CreatePivotTable TableDestination:=Range("i1"), TableName:="ÏEÇG猂1"
    'ActiveSheet.PivotTables("ÏEÇG猂1").SmallGrid = False
    ActiveSheet.PivotTables("ÏEÇG猂1").AddFields RowFields:=Range("C1"), ColumnFields:=Range("d1")
    ActiveSheet.PivotTables("ÏEÇG猂1").PivotFields(Range("F1").Text).Orientation = xlDataField
End Sub

TOP

¦^´_ 11# ­ã´£³¡ªL

¦]爲Ác²Åé°ÝÃD¡A¾É­P¶Ã½X¡A¾É­PµLªk¹B¦æ¡C ¦]爲¨S¦³­ì¤å¡A§ÚµLªk­×¥¿¶Ã½X³¡¤À¡C¥i§_µo¤@¤U­ì¤åµ¹§Ú­×¥¿¡C
Sub ¤à()
Dim Arr, Xrr, Yrr, i&, j%, V, T$, T1$, TR, x&, y&
Call 睲®J¤à
Arr = Range([L1], [A65536].End(xlUp).MergeArea)
ReDim Xrr(1 To UBound(Arr), 1 To 7)
ReDim Yrr(1 To UBound(Arr), 1 To 4)
For i = 15 To UBound(Arr)
    T = Arr(i, 1): V = Val(Arr(i, 10))
    If T Like "*L *W *H *" Then
       TR = Split(T, Chr(10)): T1 = Trim(TR(0))
       x = x + 1
       Xrr(x, 1) = T  'A °f£VÇ_计ªq
       Xrr(x, 2) = T1 'ÒÝ琜¸¡
       Xrr(x, 3) = Arr(i, 2) 'N.W.(瞓)
       Xrr(x, 4) = Arr(i, 3) 'G.W.(Çy)
       Xrr(x, 5) = Val(Mid(TR(3), 2)) 'W
       Xrr(x, 6) = Val(Mid(TR(2), 2)) 'L
       Xrr(x, 7) = Val(Mid(TR(4), 2)) 'H
    End If
    '----------------------------------
    If T1 <> "" And Arr(i, 6) <> "" And V <> 0 Then
       y = y + 1
       Yrr(y, 1) = T1 'ÒÝ琜¸¡
       Yrr(y, 2) = Arr(i, 7) '竚
       Yrr(y, 3) = Arr(i, 6) 'ÇA甧
       Yrr(y, 4) = V '计Ïü
    End If
i01: Next i
If x = 0 Then Exit Sub
With [N3].Resize(x, 7)
     .Value = Xrr
     .Borders.LineStyle = 1
     .WrapText = False
End With
With [v3].Resize(y, 4)
     .Value = Yrr
     .Borders.LineStyle = 1
End With
End Sub

Sub 睲®J?)
Range([T3], [N65536].End(xlUp)(3)).Delete Shift:=xlUp
Range([Y3], [V65536].End(xlUp)(3)).Delete Shift:=xlUp
End Sub

TOP

¦^´_ 9# 198188

±Æ¬[ªí..°j°é¦h¼h, ¦Û¦æ¬ã¨s//
Xl0000114-±Æ¬[ªí.rar (83.4 KB)

TOP

¦^´_ 9# 198188

¥ýµ¹"°e³f³æ"//
µ{¦¡½X¨S¤°¯S§O~~
Xl0000113-°e³f³æ.rar (157.61 KB)

TOP

¦^´_ 7# 198188


°õ¦æ¨S°ÝÃD!!!
split ¥Î¨Ó¤À³Î¤å¦r, "(" ¬O¤À³Î²Å

TOP

±Æ¬[ªí.rar (571.34 KB) °e³f³æ.rar (177.03 KB) ¦^´_ 5# ­ã´£³¡ªL

°e³f³æ
®Ú¾Ú¨C­Ósheet  ±q¥ªÃä°e³f³æ¸ê®Æ©â¨ú¸ê®Æ¡A½Æ»s¨ì¥kÃä¡C
®Ú¾ÚAÄ檺¸ê®Æ½Æ»s¦³¤Ø¤oªº¸ê®Æ¨ìNÄæ¡A¦P®É½Æ»sÄæB¨ìÄæP & ÄæC¨ìÄæQµM«á§â³oÄ檺¸ê®Æ¤À³Î¶}¨ìÄæO, R, S, T,
¤§«á½Æ»sÄæO¨ìÄæV , µM«á®Ú¾ÚÄæOªº³f¬[¸¹Åª¨úÄæG ¨ìÄæW, ÄæF ¨ìÄæX, ÄæJ¨ìÄæY

±Æ¬[ªí
®Ú¾ÚBF ùØÄæAªº¸ê®Æ¡A¦³#001 - #009 ¡]³o­Ó¤£©T©w¦³¦h¤Ö­Ó¡^½ÆÂø·sªºSHEET ¥H#001 - #009 ¤À§O©R¦W
BF ùØÄæA ªº#001 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #001 ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#002 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #002ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#003 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #003ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#004 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #004ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
¦p¦¹Ãþ±À

TOP

±Æ¬[ªí.rar (571.34 KB) °e³f³æ.rar (177.03 KB) ¦^´_ 2# singo1232001


°e³f³æ
®Ú¾Ú¨C­Ósheet  ±q¥ªÃä°e³f³æ¸ê®Æ©â¨ú¸ê®Æ¡A½Æ»s¨ì¥kÃä¡C
®Ú¾ÚAÄ檺¸ê®Æ½Æ»s¦³¤Ø¤oªº¸ê®Æ¨ìNÄæ¡A¦P®É½Æ»sÄæB¨ìÄæP & ÄæC¨ìÄæQµM«á§â³oÄ檺¸ê®Æ¤À³Î¶}¨ìÄæO, R, S, T,
¤§«á½Æ»sÄæO¨ìÄæV , µM«á®Ú¾ÚÄæOªº³f¬[¸¹Åª¨úÄæG ¨ìÄæW, ÄæF ¨ìÄæX, ÄæJ¨ìÄæY

±Æ¬[ªí
®Ú¾ÚBF ùØÄæAªº¸ê®Æ¡A¦³#001 - #009 ¡]³o­Ó¤£©T©w¦³¦h¤Ö­Ó¡^½ÆÂø·sªºSHEET ¥H#001 - #009 ¤À§O©R¦W
BF ùØÄæA ªº#001 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #001 ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#002 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #002ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#003 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #003ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
BF ùØÄæA ªº#004 ¡AùØ­±¦³¤@¨ÇSR****¡A®Ú¾Ú³o¨ÇSR**** Ū¨ú±Æ¬[ªíùØ­±ªº¸ê®Æ½Æ»s¨ìSHEET #004ùØ­±¡AµM«á°µ¤@­Ó¼Ï¯Ã¤ÀªRªí
¦p¦¹Ãþ±À

TOP

¦^´_ 5# ­ã´£³¡ªL

°õ¦æ®É¡A¨ì    Brr(R, C) = Split(T, "(")(0)³oùØ¥X¿ù¡C
¯à¤£¯àª`ÄÀ¤@¤Uµ{¦¡ªº·N«ä¡A¤è«K§Ú¥i¥H¾Ç²ß¡AÁÂÁ¡I

test1.rar (16.79 KB)

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-12-26 08:36 ½s¿è

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:


°õ¦æµ²ªG:


Option Explicit
Sub TEST()
Dim ¸ê®Æ°}¦C, ªÅ°}¦C, ¦r¨å, ¥N¸¹$, i&, j%, µ²ªG¦C¸¹&, µ²ªGÄ渹%, µ²ªGÄæ¼Æ%, ³Ì¤j¦C¼Æ%, ¤uµ{§O$, ÃöÁä¦r$
Set ¦r¨å = CreateObject("Scripting.Dictionary")
ÃöÁä¦r = Left([B2], 4)
¸ê®Æ°}¦C = Range([F3], [B65536].End(3)(2, 0))
ReDim ªÅ°}¦C(1 To 1000, 1 To 100)
For i = 1 To UBound(¸ê®Æ°}¦C) - 1
   If InStr(¸ê®Æ°}¦C(i, 1), ÃöÁä¦r) = 0 Then GoTo i01
   µ²ªGÄ渹 = IIf(¤uµ{§O <> ¸ê®Æ°}¦C(i, 1), µ²ªGÄ渹 + 1, µ²ªGÄ渹)
   ¦r¨å(i) = µ²ªGÄ渹
   ¤uµ{§O = ¸ê®Æ°}¦C(i, 1)
   ¦r¨å(µ²ªGÄ渹 & "/r") = 1
   ªÅ°}¦C(1, µ²ªGÄ渹) = Split(¸ê®Æ°}¦C(i, 1), " ")(0)
   ¸ê®Æ°}¦C(i + 1, 1) = IIf(¸ê®Æ°}¦C(i + 1, 1) = "", ¸ê®Æ°}¦C(i, 1), ¸ê®Æ°}¦C(i + 1, 1))
i01: Next
µ²ªGÄæ¼Æ = µ²ªGÄ渹
For j = 2 To UBound(¸ê®Æ°}¦C, 2)
   For i = 1 To UBound(¸ê®Æ°}¦C)
      ¥N¸¹ = Split(¸ê®Æ°}¦C(i, j) & " ", " ")(1)
      If Not ¥N¸¹ Like "[A-Z][A-Z]####*" Or ¦r¨å(i) = 0 Then GoTo i02
      µ²ªGÄ渹 = ¦r¨å(i)
      µ²ªG¦C¸¹ = ¦r¨å(µ²ªGÄ渹 & "/r")
      µ²ªG¦C¸¹ = µ²ªG¦C¸¹ + 1: ¦r¨å(µ²ªGÄ渹 & "/r") = µ²ªG¦C¸¹
      ªÅ°}¦C(µ²ªG¦C¸¹, ¦r¨å(i)) = Left(¥N¸¹, 6)
      If ³Ì¤j¦C¼Æ < µ²ªG¦C¸¹ Then ³Ì¤j¦C¼Æ = µ²ªG¦C¸¹
i02: Next
Next
With [H2]
     .CurrentRegion.ClearContents
     .Resize(³Ì¤j¦C¼Æ, µ²ªGÄæ¼Æ) = ªÅ°}¦C
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD