4、n = Range(Column & Rows.Count).End(xlUp).Row End Function 注意,要输入新数据的列可能与我们所查找最后一行时所使用的列不同, 例如,在上例中,我们可以修改为在 B列中查找该列的最后一行,而在 A 列相 应行的下一行中输入新的数据。使用 Find 方法Find 方法在当前工作有数据中进行查找,不需要指定列...
RngFind过程使用Find方法在工作表Sheet1的A列中查找InputBox函数对话框中所输入的值,并查找该值所在的第一个单元格。 第6到第13行代码在工作表Sheet1的A列中查找InputBox函数对话框中所输入的值。应用于Range对象的Find方法在区域中查找特定信息,并返回Range对象,该对象代表用于查找信息的第一个单元格。如果未发现...
range(“data”) 代表名为data的数据区域range属性的参数可以是对象也可以是字符串,如:range(“a1”,range(“lastcell”))3、单元格引用的快捷方式可以在引用区域两侧加上方括号来快速引用单元格区域,如:b2a1:d10a1:a10,c1:c10,e1:e10data但其引用的是绝对区域.4、cells属性可以使用cells属性来引用range对象...
RealLastRow = Cells.Find("*", Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row RealLastColumn = Cells.Find("*", Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column Cells(RealLastRow, RealLastColumn).Select End Sub 该示例用来查找出当前工作表中的最后单元,并将其选中,主要...
[ 示例代码 06] Sub NextRowUsedAsSub() 选取最后一行的下一行 Range(A Cells.Find(*, LookIn:=xlFormulas, SearchDirection:=xlPrevious).Row + 1).Select End Sub [ 示例代码 07] Sub NextRowUsedAsFunction() 选取最后一行的下一行 (调用函数 ) Range(A LastRow + 1).Select End Sub Public ...
Sub FindSample1() Dim Cell As Range, FirstAddress As String With Worksheets(1).Range("A1:A50") Set Cell = .Find(5) If Not Cell Is Nothing Then FirstAddress = Cell.Address Do With Worksheets(1).Ovals.Add(Cell.Left, _ Cell.Top, Cell.Width, _ ...
SetLastCell=.Cells(.Cells.Count) EndWith SetFoundCell=SearchRange.Find(what:=FindWhat,after:=LastCell,_ LookIn:=LookIn,LookAt:=LookAt,SearchOrder:=SearchOrder,MatchCase:=MatchCase) IfNotFoundCellIsNothingThen SetFoundCells=FoundCell FirstAddr=FoundCell.Address ...
Set rng = ws.Range("A1:A10")' 找到最后一个有数据的行 lastRow = ws.Cells(ws.Rows.Count, ...
Set r =dt.Range("b:b").Find(WorksheetFunction.Min(dt.[b:b]), dt.[b1],xlValues, xlWhole) ob.Rows(CStr(Split(ob.[a1].CurrentRegion.Address,"$")(4) + 2) & ":" & _ CStr(Split(ob.Shapes(r.Offset(,-1)).TopLeftCell.Address, "$")(2) - 2)).Delete ...
5– Using Range.Find To Find Last Row Important Things To Note Frequently Asked Questions Download Template Recommended Articles Key Takeaways VBA Last row is used to find the last row in the worksheet. Finding the last row means the first non-blank cell from the bottom of the worksheet. ...