Private Sub Worksheet_SelectionChange(ByVal Target As Range) '可以直接sub(),不然选择就会触发vba Dim rows_count As Integer Dim rows_id As Integer Dim column_count As Integer Dim column_id As Integer column_count = Selection.Columns.Count '返回选择区域列数
VBA 选择使用区域 Sub Select_UsedRange() ActiveSheet.Range(ActiveSheet.Cells(1, 1), ActiveSheet.UsedRange).Select End Sub rc = .range("a1").CurrentRegion.Rows.Count cc = .range("a1").CurrentRegion.Columns.Count cc = .Range(.Cells(1, 1), .Used
compared all possibilities with a long test sheet: 0,140625 sec for lastrow = calcws.Cells.Find("*", [A1], , , xlByColumns, xlPrevious).row 0 sec for iLastRow = calcws.Cells(rows.count, "a").End(xlUp).row and numofrows = calcws.Cells.S
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ 1 base code use master drop database helloworld --创建一个数据库 create database helloworld --用helloworld1这个数据库 use helloworld --创建一个表格teacher create table