合并前3个最高值行和列

时间:2016-11-17 02:05:15

标签: excel vba excel-vba merge

我想要一个可以自动合并一起识别的前三个值的宏。

我有一个宏可以通过使用条件格式识别前3个最高,如下所示,但我不确定在宏下可以添加什么vba,其中识别的前3个值可以自动与其行合并在一起我用任何数据运行宏时的列。

Eg. D1 D2  D3     After running the macro:            D1  (D2+D3)
T1   1 2  3                                (T2+T3+T4)  7     27
T2   2 6  2                                   T1       1     5                       
T3   3 4  5                                  
T4   2 7  3


Sub Top3Highest()
'
' Top3Highest Macro
'

'
    Range("A:Z").Select
    Selection.FormatConditions.AddTop10
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1)
        .TopBottom = xlTop10Top
        .Rank = 3
        .Percent = False
    End With
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False
End Sub

请帮助谢谢!

0 个答案:

没有答案
相关问题