我想要第一行和最后一行使用非空白单元格。 我最后一排工作正常,第一排是胸围。建议感激。VBA使用数据识别第一行和最后一行
Sub idDataRange()
Dim firstRow As Long
Dim lastRow As Long
Sheets("fileNames").Select
' this has been adapted from a Stack overflow answer. lastRow unedited
' first row I changed Up to Down = NOT the solution!
With ActiveSheet
firstRow = .Range("B" & .Rows.Count).End(xlDown).row
lastRow = .Range("B" & .Rows.Count).End(xlUp).row
End With
MsgBox "the first row is " & firstRow
MsgBox "last row is " & lastRow
End Sub
工程就像一个魅力 - 现在我必须走开并尝试理解它! – m4sterbunny