我有这样的数据
A B C D
1. Customer T/C NET VAT
2. Sandy T1
3. Sandy T5
4. Sandy T1
5. Sandy T5
6. Candy T1
7. Candy T5
8. Dandy T5
9. Dandy T1
where NET
and VAT
contains $Amount
& 1,2
etc 是行号 & T1/T5 是 TaxCodes
汇总列
R S T
1. Customer T5NET T5VAT
2. Sandy
3. Candy
4. Dandy
我想分别在客户面前的摘要列中总结NET
+ 。VAT
cell.address
示例:汇总列
R S T
1. Customer T5NET T5VAT
2. Sandy =C3+C5 =D3+D5
3. etc
我假设我需要一个Match
函数来匹配#1 Customer
(汇总到数据库),#2 T5
然后将偏移值与汇总名称连接起来。
立即编辑(这很接近,但我如何为匹配功能更改它?)
`Sub MatchConcanate()
Dim outputText As String, Rw As Range, cell As Range
delim = "+"
Application.ScreenUpdating = False
Range("A:A").SpecialCells(xlCellTypeConstants).Select
For Each Rw In Selection.Columns
'Here I want it to only Select Supplier till it is duplicate (they are sorted) and then to next
For Each cell In Rw.Cells
If cell.Value = "T5" Then
outputText = outputText & delim & cell.Address
End If
Next cell
With Rw
'Here I'd like a match function instead of pasting it all in cell 1
.Cells(1).Offset(0, 5).Value = outputText
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
End With
outputText = ""
Next Rw
Application.ScreenUpdating = True
End Sub`