标题:代码怎么修改?
只看楼主
asad
Rank: 1
等 级:新手上路
威 望:1
帖 子:67
专家分:0
注 册:2019-12-6
结帖率:80%
 问题点数:0 回复次数:2 
代码怎么修改?
Set d = CreateObject("scripting.dictionary")
        r = Range("h" & Rows.Count).End(xlUp).Row
        arr = Range("w5:ay" & r)
        ReDim brr(1 To UBound(arr), 1 To 3)
        For i = 1 To UBound(arr)
            If Not d.Exists(s) Then
                m = m + 1
                d(s) = m
                brr(m, 1) = s
                brr(m, 2) = 1
                brr(m, 3) = arr(i, 1)
            Else
                brr(d(s), 2) = brr(d(s), 2) + 1
                brr(d(s), 3) = brr(d(s), 3) + arr(i, 1)
            End If
        Next
        For i = 1 To m
            n = n + 1
            brr(i, 1) = n
            brr(i, 2) = brr(i, 2) & "a"
            brr(i, 3) = brr(i, 3) & "b"
        Next
想用datagrid来显示brr(i, 1) brr(i, 2) brr(i, 3) 3列数据,这代码怎么修改?
搜索更多相关主题的帖子: Next 修改 代码 If End 
2019-12-06 22:50
asad
Rank: 1
等 级:新手上路
威 望:1
帖 子:67
专家分:0
注 册:2019-12-6
得分:0 
Option Explicit
Implements IRibbonExtensibility '添加对 IRibbonExtensibility 接口的引用

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    Set xlapp = Application '加载时
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
    Set xlapp = Nothing '卸载时
End Sub

'调用自定义 XML
Public Function IRibbonExtensibility_GetCustomUI(ByVal RibbonID As String) As String
    IRibbonExtensibility_GetCustomUI = GetRibbonXML()
End Function

'添加 XML 自定义代码
Public Function GetRibbonXML() As String
    Dim sRibbonXML As String
    sRibbonXML = "<customUI xmlns=""http://schemas. >" & _
                    "<ribbon startFromScratch=""false"">" & _
                        "<tabs>" & _
                            "<tab id=""hd"" label=""数据"">" & _
                                "<group id=""eh"" label=""数据"">" & _
                                    "<button id=""Button1"" label=""数据1"" size=""large"" imageMso=""HappyFace"" onAction=""a1"" />" & _
                                    "<button id=""Button2"" label=""数据2"" size=""large"" imageMso=""FormulaMoreFunctionsMenu"" onAction=""a2"" />" & _
                                    "<button id=""Button3"" label=""数据3"" size=""large"" imageMso=""FunctionsDateTimeInsertGallery"" onAction=""a3"" />" & _
                                "</group>" & _
                                "<group id=""sh"" label=""数据"">" & _
                                    "<button id=""Button4"" label=""数据4"" size=""large"" imageMso=""FindDialog"" onAction=""a4"" />" & _
                                    "<button id=""Button5"" label=""数据5"" size=""large"" imageMso=""FilterToggleFilter"" onAction=""a5"" />" & _
                                "</group>" & _
                                "<group id=""fh"" label=""数据"">" & _
                                    "<button id=""Button6"" label=""数据6"" size=""large"" imageMso=""BlogHomePage"" onAction=""a6"" />" & _
                                    "<button id=""Button7"" label=""数据7"" size=""large"" imageMso=""HyperlinkInsert"" onAction=""a7"" />" & _
                                "</group>" & _
                                "<group id=""ch"" label=""数据"">" & _
                                    "<button id=""Button8"" label=""数据8"" size=""large"" imageMso=""Calculator"" onAction=""a8"" />" & _
                                    "<button id=""Button9"" label=""数据9"" size=""large"" imageMso=""DeclineInvitation"" onAction=""a9"" />" & _
                                "</group>" & _
                            "</tab>" & _
                        "</tabs>" & _
                    "</ribbon>" & _
                 "</customUI>"
    GetRibbonXML = sRibbonXML
End Function
   
Public Sub a1(ByVal control As IRibbonControl)
   
End Sub
2019-12-20 10:23
asad
Rank: 1
等 级:新手上路
威 望:1
帖 子:67
专家分:0
注 册:2019-12-6
得分:0 
Public Function GetRibbonXML() As String
    Dim sRibbonXML As String
    sRibbonXML = "<customUI xmlns=""http://schemas. >" & _
                    "<ribbon startFromScratch=""false"">" & _
                        "<tabs>" & _
                            "<tab id=""caidan"" label=""数据"">" & _
                                "<group id=""zidingyi"" label=""数据"">" & _
                                    "<menu id=""menu1"" label=""数据""  size=""large"" itemSize=""large"" imageMso=""HappyFace"">" & _
                                        "<menuSeparator id=""rxmSep01"" title=""数据"" />" & _
                                            "<button id=""Button1"" label=""数据1"" imageMso=""HappyFace"" onAction=""a1"" />" & _
                                            "<button id=""Button2"" label=""数据2"" imageMso=""FormulaMoreFunctionsMenu"" onAction=""a2"" />" & _
                                            "<button id=""Button3"" label=""数据3"" imageMso=""FunctionsDateTimeInsertGallery"" onAction=""a3"" />" & _
                                        "<menuSeparator id=""rxmSep02"" title=""数据"" />" & _
                                            "<button id=""Button4"" label=""数据4"" imageMso=""FindDialog"" onAction=""a4"" />" & _
                                            "<button id=""Button5"" label=""数据5"" imageMso=""FilterToggleFilter"" onAction=""a5"" />" & _
                                        "<menuSeparator id=""rxmSep03"" title=""数据"" />" & _
                                            "<button id=""Button6"" label=""数据6"" imageMso=""BlogHomePage"" onAction=""a6"" />" & _
                                            "<button id=""Button7"" label=""数据7"" imageMso=""HyperlinkInsert"" onAction=""a7"" />" & _
                                        "<menuSeparator id=""rxmSep04"" title=""数据"" />" & _
                                            "<button id=""Button8"" label=""数据8"" imageMso=""Calculator"" onAction=""a8"" />" & _
                                            "<button id=""Button9"" label=""数据9"" imageMso=""DeclineInvitation"" onAction=""a9"" />" & _
                                    "</menu>" & _
                                "</group>" & _
                            "</tab>" & _
                        "</tabs>" & _
                    "</ribbon>" & _
                 "</customUI>"
    GetRibbonXML = sRibbonXML
End Function
2019-12-20 10:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-498255-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015610 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved