

    Max = 1
    For  lCol = 1 To 17 ' количество колонок
        Cells(65536, lCol).End(xlUp).Select
        If Max < ActiveCell.Row Then Max = ActiveCell.Row
    Next  lCol
    MsgBox (Max)

Max = 1
For lCol = 1 To 17  
    a = Cells(65536, lCol).End(xlUp).Row
    If Max < a Then Max = a
Next lCol
MsgBox (Max)



    Set ws = ThisWorkbook.Worksheets(1)
    For i = ws.UsedRange.Rows.Count To 1 Step -1
        s = ""
        For Each cc In ws.Range(ws.Rows(i).Address)
            s = s & cc
        Next
        MsgBox s
    Next

smaharbA писал(а):Set ws = ThisWorkbook.Worksheets(1)
arr = ws.Application.WorksheetFunction.Transpose(ws.UsedRange)
ActiveSheet.UsedRange.Rows.Count
smaharbA писал(а):И еще если уж ненравится массив
- Код: Выделить всё
 Set ws = ThisWorkbook.Worksheets(1)
For i = ws.UsedRange.Rows.Count To 1 Step -1
s = ""
For Each cc In ws.Range(ws.Rows(i).Address)
s = s & cc
Next
MsgBox s
Next
    Set ws = ThisWorkbook.Worksheets(1)
    For i = ws.UsedRange.Rows.Count To 1 Step -1
        s = ""
        For Each cc In ws.Range(ws.Rows(i).Address)
            s = s & cc
        Next
        If Len(s) > 0 Then Exit For
    Next
    MsgBox ("Последняя заполненная строка=" & i)

Set ws = ThisWorkbook.Worksheets(1) 
For i = ws.UsedRange.Rows.Count To 1 Step -1 
  MsgBox ws.Application.WorksheetFunction.Min(ws.Rows(i))
Next 

Max = 1
For lCol = 1 To 17 
    a = Cells(65536, lCol).End(xlUp).Row
    If Max < a Then Max = a
Next lCol
MsgBox (Max)

uhm писал(а):Если в таблице нет пустых ячеек, то может помочь что-то вроде
- Код: Выделить всё
 Range("A1").End(xlDown).End(xlToRight).Select
А так - наверное, макросом только.

Function GetLastRow(sh As Worksheet) As Long
  On Error Resume Next
  GetLastRow = WorksheetFunction.Max(sh.Cells.SpecialCells(xlCellTypeConstants).Areas( _
    sh.Cells.SpecialCells(xlCellTypeConstants).Areas.Count).Row, sh.Cells.SpecialCells( _
    xlCellTypeFormulas).Areas(sh.Cells.SpecialCells(xlCellTypeFormulas).Areas.Count).Row)
End Function

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 9