|
楼主 |
发表于 2018-7-13 12:06
|
显示全部楼层
上面的附件代码没保存到。
不过应该会了,用like判断表包含字符.
谢谢!
Sub 按钮1_Click()
Application.ScreenUpdating = False
Sheets("2018年订单明细表-USD").Select
For Each sh In Sheets
With sh
If .Name Like "*TAPEX*" Then
If Columns(2).Find(Split(.[g8], "订单号:")(1), lookat:=xlWhole) Is Nothing Then
r = Cells(Rows.Count, 1).End(3).Row + 1
For j = 13 To .Cells(Rows.Count, 1).End(3).Row
If .Cells(j, 1) = "合计" Then
x = j
Exit For
End If
Next j
Cells(r, 1).Resize(x - 13).Value = Split(.[g9], "订单日期:")(1)
Cells(r, 2).Resize(x - 13).Value = Split(.[g8], "订单号:")(1)
Cells(r, 3).Resize(x - 13).Value = Split(.[a11], "主题:")(1)
Cells(r, 4).Resize(x - 13).Value = .Cells(13, 2).Resize(x - 13).Value
Cells(r, 5).Resize(x - 13).Value = .Cells(13, 3).Resize(x - 13).Value
Cells(r, 6).Resize(x - 13).Value = .Cells(13, 4).Resize(x - 13).Value
Cells(r, 7).Resize(x - 13).Value = .Cells(13, 5).Resize(x - 13).Value
Cells(r, 8).Resize(x - 13).Value = .Cells(13, 6).Resize(x - 13).Value
Cells(r, 9).Resize(x - 13).Value = .Cells(13, 7).Resize(x - 13).Value
End If
End If
End With
Next sh
Application.ScreenUpdating = True
End Sub
|
|