VBA find the last column on an Excel worksheet

Finding the last used column on any given row is useful in Excel when automating tasks or creating a database. It is especially useful when your dataset may expand and contract from a static size and area. Used in conjunction with the last used row creates a powerful process for VBA and data automation.

It can be used as a standalone stored procedure or pasted into a module and adapted as you see fit for purpose.

This particular piece of code is used in the majority of our projects and certainly in projects where data is analysed, moved or manipulated in any way.

Feel free to ask us a question, or comment below…



Public Sub Last_used_Column()

With ActiveSheet
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With

End Sub






Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology

Leave a Reply

Your email address will not be published. Required fields are marked *