ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get last column (https://www.excelbanter.com/excel-programming/396122-get-last-column.html)

Les Stout[_2_]

Get last column
 
Hi all, i need to get the last used column, as it can be a variable
amount of columns, so that i can autofit them. Can somebody help me out
my misery please... :-0)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

JLGWhiz

Get last column
 
This assumes row 1 is your longest row.

lastCol = Cells(1, Columns.Count).End(xlToLeft).Column

"Les Stout" wrote:

Hi all, i need to get the last used column, as it can be a variable
amount of columns, so that i can autofit them. Can somebody help me out
my misery please... :-0)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com