Purfleet
England
Member
Members
Trusted Members
Trusted Members
Forum Posts: 414
Member Since:
December 20, 2019
December 20, 2019
Offline
Probably the most useful piece of code I have learnt.
Sub FindLastRow()
Dim Lr As Long
Lr = Cells(Rows.Count, 1).End(xlUp).Row
Debug.Print Lr
Range("a1:a" & Lr).Select
End Sub
This code will check, from the bottom upwards, and find hte last used row, you can then use the variable of LR to create a range like Range("a1:a" & Lr) and do what you need to with it. the number 1 in the middle is the column number you want to check so if you need to find the last used row in column E you would put in 5 and so on.
The variable letters can be changed to whatever suits (within reason)
Purfleet
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Heike Valentin, Dymph Noë, Kang-Ting Lee, Kasper Sloth
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1917
SunnyKow: 1432
Anders Sehlstedt: 900
Purfleet: 414
Frans Visser: 346
David_Ng: 306
Hans Hallebeek: 290
lea cohen: 246
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
Excel Learner
david gavi
Rick KISA
Jan Elenbaas
Ranjeet Wankhade
Sugata Maity
Karen McCarron
Amanda Zibell
Kevin Sanderson
wer klaus
Forum Stats:
Groups: 3
Forums: 24
Topics: 6880
Posts: 30157
Member Stats:
Guest Posters: 49
Members: 33700
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —