Public Sub distinctCount() '求Col列中StartRow到EndRow范围中不重复的个数 '本例是计算标题为sheet1的Excel表中的A1:A240的不重复值的个数 '修改下面四行的结尾值 Dim sheetsCaption As String: sheetsCaption = "Sheet1" Dim Col As String: Col = "A" Dim StartRow As Integer: StartRow = 1 Dim EndRow As Integer: EndRow = 240 '以下固定 Dim Count As Integer: Count = 0 With Sheets(sheets...[ 查看全文 ]
1、打开Excel表格,按Alt+F11打开Microsoft Visual Basic点击插入→模块。 2、复制下列代码粘贴到模块中,粘贴完成后关闭模块窗口和Microsoft Visual Basic窗口。 Sub 宏1() For i = 1 To 50 Selection.EntireRow.Insert ActiveCell.Offset(2, 0).Range("A1").Select Next i End Sub 3、回到Excel表格中点击菜单栏工具→宏(M)→宏(M)如图红框所示! 4、选择宏1在点击...[ 查看全文 ]