发布网友 发布时间:2022-05-30 17:26
共1个回答
热心网友 时间:2023-10-22 03:59
xrow = .Range("A1").CurrentRegion.Rows.Count + 1'返回A1的当前区域的总行数+1不用ARR当然也是可以的,但是得用循环。所以还是用数组好些
小点是With用的,前面有WITH,可以简化代码,避免重复书写
With ActiveWorkbook.Worksheets(1)
xrow = .Range("A1").CurrentRegion.Rows.Count + 1
arr = Array(xrow - 1, "张姣", "女", #7/8/1987#, #9/1/2010#, "10年新招")
.Cells(xrow, 1).Resize(1, 6) = arr
End With
等同于
xrow = ActiveWorkbook.Worksheets(1).Range("A1").CurrentRegion.Rows.Count + 1
arr = Array(xrow - 1, "张姣", "女", #7/8/1987#, #9/1/2010#, "10年新招")
ActiveWorkbook.Worksheets(1).Cells(xrow, 1).Resize(1, 6) = arr