Czy tak wystarczy?
Sub ostatnia()
Dim wiersz As Long
Dim kolumna As Integer
Dim adres As String
For kolumna = 1 To Columns.Count
If Cells(Rows.Count, kolumna) <> "" Then adres = Cells(Rows.Count, kolumna).Address(0, 0)
Next kolumna
If adres = "" Then
For kolumna = 1 To Columns.Count
If Cells(Rows.Count, kolumna).End(xlUp).Row >= wiersz And Cells(Rows.Count, kolumna).End(xlUp) <> "" Then
wiersz = Cells(Rows.Count, kolumna).End(xlUp).Row
adres = Cells(Rows.Count, kolumna).End(xlUp).Address(0, 0)
End If
Next kolumna
End If
If adres = "" Then
MsgBox "Wszystkie komórki są puste."
Else
MsgBox "Ostatnia niepusta komórka to " & adres & " o zawartości """ & Range(adres) & """"
End If
End Sub
Pozdrawiam |