在我的excel工作簿中,我有一个294列宽的“数据表”,其中包含许多足球比赛的数据。该数据表上的每一行对应于一个匹配项的数据。由于列的数量,数据几乎无法读取,因此要过滤数据,我编写了一个VBA代码,该代码当前循环遍历所有数据,并且在满足各种匹配条件时,它将数据添加到行上的列中不同的表,例如 A栏(主队),B栏(客队),C栏(一些数据),D栏(一些数据)等...
我想对其进行更改,而不是将一场比赛匹配,而不是将它分成两行一场匹配。这样做的简单原因是让我获得了一些空间,并使它更具可读性。
例如,我希望它阅读:
第3行(主队)和这些列包含主队的所有数据。 第4行(客队)和列中包含客队的所有数据。
这是我的原始VBA:
Sub LTATrades()
Application.ScreenUpdating = False
Dim LastRow As Long, fs As Worksheet, ds As Worksheet, x As Long
Set fs = Sheets("Filters")
Set ds = Sheets("Data")
LastRow = ds.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ClearSelections
SortData
DeleteCF
For x = 4 To LastRow
If ds.Cells(x, 1) = ds.Range("E1") And ds.Cells(x, 40) >= fs.Range("C2") And ds.Cells(x, 41) >= fs.Range("C2") Then
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "B").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 3)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "C").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 4)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "D").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 5)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "E").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 81)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "F").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 91)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "G").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 82)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "H").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 92)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "I").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 83)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "J").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 93)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "K").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 84)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "L").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 94)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "M").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 85)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "N").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 96)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "O").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 95)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "P").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 86)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "Q").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 88)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "R").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 98)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "S").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 57).Value / ds.Cells(x, 40).Value) * 100, 0) & "% (" & ds.Cells(x, 57).Value & "/" & ds.Cells(x, 40).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "T").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 71).Value / ds.Cells(x, 41).Value) * 100, 0) & "% (" & ds.Cells(x, 71).Value & "/" & ds.Cells(x, 41).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "U").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 58).Value / ds.Cells(x, 40).Value) * 100, 0) & "% (" & ds.Cells(x, 58).Value & "/" & ds.Cells(x, 40).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "V").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 72).Value / ds.Cells(x, 41).Value) * 100, 0) & "% (" & ds.Cells(x, 72).Value & "/" & ds.Cells(x, 41).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "W").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 229).Value + ds.Cells(x, 243).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 229).Value + ds.Cells(x, 243).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "X").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 257).Value + ds.Cells(x, 275).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 257).Value + ds.Cells(x, 275).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "Y").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 54).Value + ds.Cells(x, 68).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 54).Value + ds.Cells(x, 68).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "Z").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 55).Value + ds.Cells(x, 69).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 55).Value + ds.Cells(x, 69).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "AA").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 56).Value + ds.Cells(x, 70).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 56).Value + ds.Cells(x, 70).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "AB").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 59).Value + ds.Cells(x, 73).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 59).Value + ds.Cells(x, 73).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "AC").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 144).Value + ds.Cells(x, 159).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 144).Value + ds.Cells(x, 159).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "AD").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 147).Value + ds.Cells(x, 162).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 147).Value + ds.Cells(x, 162).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
End If
Next x
ResetCFLTA
Application.ScreenUpdating = True
End Sub
现在,这就是我试图使其按需运行的方式...
Sub LTATradesTest()
Application.ScreenUpdating = False
Dim LastRow As Long, fs As Worksheet, ds As Worksheet, x As Long
Set fs = Sheets("Filters")
Set ds = Sheets("Data")
LastRow = ds.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ClearSelections
SortData
For x = 4 To LastRow
If ds.Cells(x, 1) = ds.Range("E1") And ds.Cells(x, 40) >= fs.Range("C2") And ds.Cells(x, 41) >= fs.Range("C2") Then
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "B").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 3)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "C").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 4)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "C").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 5)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "D").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 81)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "D").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 91)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "E").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 82)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "E").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 92)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "F").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 83)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "F").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 93)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "G").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 84)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "G").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 94)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "H").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 85)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "H").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 96)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "I").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 95)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "I").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 86)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "J").End(xlUp).Offset(1, 0).Value = ds.Cells(x, 88)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "J").End(xlUp).Offset(2, 0).Value = ds.Cells(x, 98)
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "K").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 57).Value / ds.Cells(x, 40).Value) * 100, 0) & "% (" & ds.Cells(x, 57).Value & "/" & ds.Cells(x, 40).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "K").End(xlUp).Offset(2, 0).Value = Round((ds.Cells(x, 71).Value / ds.Cells(x, 41).Value) * 100, 0) & "% (" & ds.Cells(x, 71).Value & "/" & ds.Cells(x, 41).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "L").End(xlUp).Offset(1, 0).Value = Round((ds.Cells(x, 58).Value / ds.Cells(x, 40).Value) * 100, 0) & "% (" & ds.Cells(x, 58).Value & "/" & ds.Cells(x, 40).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "L").End(xlUp).Offset(2, 0).Value = Round((ds.Cells(x, 72).Value / ds.Cells(x, 41).Value) * 100, 0) & "% (" & ds.Cells(x, 72).Value & "/" & ds.Cells(x, 41).Value & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "M").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 229).Value + ds.Cells(x, 243).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 229).Value + ds.Cells(x, 243).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "M").End(xlUp).Offset(2, 0).Value = Round(((ds.Cells(x, 257).Value + ds.Cells(x, 275).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 257).Value + ds.Cells(x, 275).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "N").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 54).Value + ds.Cells(x, 68).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 54).Value + ds.Cells(x, 68).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "N").End(xlUp).Offset(2, 0).Value = Round(((ds.Cells(x, 55).Value + ds.Cells(x, 69).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 55).Value + ds.Cells(x, 69).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "O").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 56).Value + ds.Cells(x, 70).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 56).Value + ds.Cells(x, 70).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "O").End(xlUp).Offset(2, 0).Value = Round(((ds.Cells(x, 59).Value + ds.Cells(x, 73).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 59).Value + ds.Cells(x, 73).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "P").End(xlUp).Offset(1, 0).Value = Round(((ds.Cells(x, 144).Value + ds.Cells(x, 159).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 144).Value + ds.Cells(x, 159).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
Sheets("LTA").Cells(Sheets("LTA").Rows.Count, "P").End(xlUp).Offset(2, 0).Value = Round(((ds.Cells(x, 147).Value + ds.Cells(x, 162).Value) / (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value)) * 100, 0) & "% (" & (ds.Cells(x, 147).Value + ds.Cells(x, 162).Value) & "/" & (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
End If
Next x
Application.ScreenUpdating = True
End Sub
有人可以帮助我实现我想要的吗?
有轻微的障碍。如您所见,第一条数据对两支球队来说都是通用的(这是联盟的名称)。总之有什么要告诉excel合并B列的两行吗?
致谢
答案 0 :(得分:0)
Option Explicit
Sub LTATradesTest()
Application.ScreenUpdating = False
Dim LastRow As Long, fs As Worksheet, ds As Worksheet, x As Long
Dim ltaLR As Long
With ThisWorkbook
Set fs = .Worksheets("Filters")
Set ds = .Worksheets("Data")
End With
LastRow = ds.Cells.Find("*", LookIn:=xlFormulas, Lookat:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ClearSelections
SortData
For x = 4 To LastRow
If ds.Cells(x, 1) = ds.Range("E1") And ds.Cells(x, 40) >= _
fs.Range("C2") And ds.Cells(x, 41) >= fs.Range("C2") Then
With ThisWorkbook.Worksheets("LTA")
ltaLR = .Cells.Find("*", LookIn:=xlFormulas, Lookat:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
.Cells(ltaLR, "B").Value = ds.Cells(x, 3)
.Cells(ltaLR, "B").Resize(2, 1).Merge
.Cells(ltaLR, "C").Value = ds.Cells(x, 4)
.Cells(ltaLR + 1, "C").Value = ds.Cells(x, 5)
.Cells(ltaLR, "D").Value = ds.Cells(x, 81)
.Cells(ltaLR + 1, "D").Value = ds.Cells(x, 91)
.Cells(ltaLR, "E").Value = ds.Cells(x, 82)
.Cells(ltaLR + 1, "E").Value = ds.Cells(x, 92)
.Cells(ltaLR, "F").Value = ds.Cells(x, 83)
.Cells(ltaLR + 1, "F").Value = ds.Cells(x, 93)
.Cells(ltaLR, "G").Value = ds.Cells(x, 84)
.Cells(ltaLR + 1, "G").Value = ds.Cells(x, 94)
.Cells(ltaLR, "H").Value = ds.Cells(x, 85)
.Cells(ltaLR + 1, "H").Value = ds.Cells(x, 96)
.Cells(ltaLR, "I").Value = ds.Cells(x, 95)
.Cells(ltaLR + 1, "I").Value = ds.Cells(x, 86)
.Cells(ltaLR, "J").Value = ds.Cells(x, 88)
.Cells(ltaLR + 1, "J").Value = ds.Cells(x, 98)
.Cells(ltaLR, "K").Value = Round((ds.Cells(x, 57).Value _
/ ds.Cells(x, 40).Value) * 100, 0) & "% (" _
& ds.Cells(x, 57).Value & "/" & ds.Cells(x, 40).Value & ")"
.Cells(ltaLR + 1, "K").Value = Round((ds.Cells(x, 71).Value _
/ ds.Cells(x, 41).Value) * 100, 0) & "% (" _
& ds.Cells(x, 71).Value & "/" & ds.Cells(x, 41).Value & ")"
.Cells(ltaLR, "L").Value = Round((ds.Cells(x, 58).Value _
/ ds.Cells(x, 40).Value) * 100, 0) & "% (" _
& ds.Cells(x, 58).Value & "/" & ds.Cells(x, 40).Value & ")"
.Cells(ltaLR + 1, "L").Value = Round((ds.Cells(x, 72).Value _
/ ds.Cells(x, 41).Value) * 100, 0) & "% (" _
& ds.Cells(x, 72).Value & "/" & ds.Cells(x, 41).Value & ")"
.Cells(ltaLR, "M").Value = Round(((ds.Cells(x, 229).Value _
+ ds.Cells(x, 243).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 229).Value + ds.Cells(x, 243).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR + 1, "M").Value = Round(((ds.Cells(x, 257).Value _
+ ds.Cells(x, 275).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 257).Value + ds.Cells(x, 275).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR, "N").Value = Round(((ds.Cells(x, 54).Value + _
ds.Cells(x, 68).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 54).Value + ds.Cells(x, 68).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR + 1, "N").Value = Round(((ds.Cells(x, 55).Value _
+ ds.Cells(x, 69).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 55).Value + ds.Cells(x, 69).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR, "O").Value = Round(((ds.Cells(x, 56).Value _
+ ds.Cells(x, 70).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 56).Value + ds.Cells(x, 70).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR + 1, "O").Value = Round(((ds.Cells(x, 59).Value _
+ ds.Cells(x, 73).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 59).Value + ds.Cells(x, 73).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR, "P").Value = Round(((ds.Cells(x, 144).Value _
+ ds.Cells(x, 159).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 144).Value + ds.Cells(x, 159).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
.Cells(ltaLR + 1, "P").Value = Round(((ds.Cells(x, 147).Value _
+ ds.Cells(x, 162).Value) / (ds.Cells(x, 40).Value _
+ ds.Cells(x, 41).Value)) * 100, 0) & "% (" _
& (ds.Cells(x, 147).Value + ds.Cells(x, 162).Value) & "/" _
& (ds.Cells(x, 40).Value + ds.Cells(x, 41).Value) & ")"
End With
End If
Next x
Application.ScreenUpdating = True
End Sub