1、选取一个单元格: Range("A1").select Range("A" & 1).select Cells(1).select Cells(1, 1).select Cells(1, "A").select 2、选取连续单元格: Range("a1:b10").select Range("a1", "b10").select Range(Cells(1, 1), Cells(10, 2)).select 3、选取不连续单元格: Range("a1,b2,c3").select Union(Range("a1"), Range("b2"), Range("c3")).select Union(Cells(1, 1), Cells(2, 2), Cells(3, 3)).select 4、选取行: Range("1:1").select Rows("1:1").select Rows(1).select Range("2:10").select Rows("2:10").select Range("1:1,3:5").select 5、选取列: Range("A:A").select Columns("A:A").select Columns(1).select Range("A:F").select Columns("A:F").select Range("A:B,D:F").select 6、选取所有单元格: Cells.select 7、实现分块合并单元格 Range("b1:g1, h1:m1, n1:s1").MergeCells = True ************************************************** 取最后一行行号:i = Range("A65536").End(xlUp).Row 取最后一列列号:m = Range("dz1").End(xlToLeft).Column ************************************************** Option Explicit Dim i, j, m, iCol, iRow As Integer Dim iCount, iSheet, iBook As Integer ’计算workbook中,每一个worksheet的cell为1的数目 Sub CheckNum() iCount = 0 iBook = Application.Worksheets.Count For i = 1 To iBook Sheets(i).Activate iRow = ActiveSheet.[c65535].End(xlUp).Row ’取最后一行 iCol = ActiveSheet.Range("dz2").End(xlToLeft).Column ’取最后一列 For j = 3 To iCol ’列循环 For m = 3 To iRow ’行循环 If ActiveSheet.Cells(j, m) = "1" Then iCount = iCount + 1 End If Next Next Next MsgBox "方案数为: " & iCount End Sub -------定义excel对象------ Dim Xl As Excel.Application, Sheet As Excel.Worksheet Set Xl = CreateObject("Excel.Application") '建立Excel.Application Xl.Workbooks.Add Xl.Visible = True Set Sheet = Xl.Worksheets(1) --------vba中引用函数----- Cells(30, Col) = Application.WorksheetFunction.Average(Range(strRange1)) '对当日的数据进行平均值计算