vbamania.pl
login:
hasło:
 
  *Rejestracja *Zapomniane hasło
 Dziś jest sobota, 18 maja 2024 roku.
Ustaw jako stronę startową Ulubione Napisz
PowrótPowrót do serwisu  RegulaminRegulamin rssRSS

  tytuł wątku:
Wątki dyskusji

Adres ostatniej niepustej komórki.


otwartyotwarty rozpoczął: pth postów: 5



napisał: Trebor
postów: 1209


umieszczony:
28 grudnia 2006
13:35

  
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
napisał: pth
postów: 1


umieszczony:
28 grudnia 2006
12:33

  
Jak znaleźć adres ostatniej niepustej komórki i użyć go w treści makra?


<-wstecz  1  dalej->
wszystkich stron: 1


Sortuj posty: z