Sub test()
r = Cells(Rows.Count, 1).End(3).Row
c = 7
Range("H2:J1000").ClearContents
For i = 3 To r
If Cells(i, 1).Value <> "" Then
tx = Split(Cells(i, 1).Value, " ")(0)
mr = Cells(i, 1).MergeArea.Count
If mr > 0 Then
For Each Z In Cells(i, 2).Resize(mr - 1, 5)
If UCase(Z.Value) Like "*SR*" Then
sp = Split(Z.Value, "(")(0)
sp = Replace(sp, "¤W¬[", "")
sp = Replace(sp, "¤U¬[", "")
sp = Replace(sp, " ", "")
tx = tx & "¡¶" & sp
End If
Next
c = c + 1
sp0 = Split(tx, "¡¶")
Cells(2, c).Resize(UBound(sp0) + 1, 1) = Application.Transpose(sp0)
End If
End If
Next
End Sub§@ªÌ: 198188 ®É¶¡: 2023-12-22 09:15
¨Ï¥Î°}¦C³B²z//AÄ椣¦X¨Ö¤]¥i¥H..¥u»{«DªÅ
Sub Test_A1()
Dim Arr, Brr, i&, j%, R&, Rx&, C%, X%, T$
Arr = Range([f1], [a65536].End(3).MergeArea)
ReDim Brr(1 To UBound(Arr) * 5, 1 To 99)
For i = 3 To UBound(Arr)
T = Split(Arr(i, 1) & " ", " ")(0)
If T Like "BF¤uµ{[#]###" Then C = C + 1: R = 1: Brr(R, C) = T
For j = 2 To UBound(Arr, 2)
T = Split(Arr(i, j) & " ", " ")(1)
If T Like "SR####(*" Then R = R + 1: Brr(R, C) = Split(T, "(")(0)
Next j
If R > Rx Then Rx = R
Next i
With Range("H2")
.CurrentRegion.Clear
.Resize(Rx, C) = Brr
End With
End Sub§@ªÌ: Andy2483 ®É¶¡: 2023-12-25 15:03
¦]爲Á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§@ªÌ: 198188 ®É¶¡: 2024-1-2 10:09
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Ǥ栋
'
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§@ªÌ: ã´£³¡ªL ®É¶¡: 2024-1-2 14:17
Sub §R°£¤u§@ªí()
Dim xS As Worksheet
Application.DisplayAlerts = False
For Each xS In Sheets
If xS.Name Like "[#]###" Then xS.Delete
Next
End Sub§@ªÌ: 198188 ®É¶¡: 2024-1-2 16:16